Ejemplo n.º 1
0
class NoteResource(ModelResource):
    user = fields.ForeignKey(UserResource, 'user')
    annotated = fields.ForeignKey(AnnotatedNoteResource,
                                  'annotated',
                                  related_name='note',
                                  null=True,
                                  full=True)

    class Meta:
        resource_name = 'notes'
        queryset = Note.objects.all()
        authorization = Authorization()
        validation = FormValidation(form_class=NoteForm)
        filtering = {"created": ALL}
Ejemplo n.º 2
0
class CustomNoteResource(ModelResource):
    author = fields.ForeignKey(UserResource, 'author')
    subjects = fields.ManyToManyField(SubjectResource, 'subjects')

    class Meta:
        resource_name = 'notes'
        queryset = Note.objects.all()
Ejemplo n.º 3
0
class NoteResource(ModelResource):
    user = fields.ForeignKey(UserResource, 'user')

    class Meta:
        resource_name = 'notes'
        queryset = Note.objects.all()
        authorization = Authorization()
Ejemplo n.º 4
0
class NoteWithUpdatableUserResource(ModelResource):
    author = fields.ForeignKey(UpdatableUserResource, 'author')

    class Meta:
        resource_name = 'noteswithupdatableuser'
        queryset = Note.objects.all()
        authorization = Authorization()
Ejemplo n.º 5
0
class OrderItemResource(ModelResource):
    order = fields.ForeignKey("related_resource.api.resources.OrderResource",
                              "order")

    class Meta:
        queryset = OrderItem.objects.all()
        resource_name = 'orderitem'
        authorization = Authorization()
Ejemplo n.º 6
0
class GeoNoteResource(ModelResource):
    user = fields.ForeignKey(UserResource, 'user')

    class Meta:
        resource_name = 'geonotes'
        queryset = GeoNote.objects.all()
        authorization = Authorization()
        filtering = {
            'points': ALL,
            'lines': ALL,
            'polys': ALL,
        }