Exemplo n.º 1
0
class PostResource(ModelResource):
    label = fields.ToManyField(LabelResource, 'label', null=True)

    class Meta:
        queryset = Post.objects.all()
        resource_name = 'post'
        authorization = Authorization()
Exemplo n.º 2
0
class ArticleResource(ModelResource):
    authors = fields.ToManyField(AuthorProfileResource,
                                 'authors',
                                 related_name='articles',
                                 full=True)

    class Meta:
        queryset = Article.objects.all()
        authentication = BasicAuthentication()
        authorization = PerUserAuthorization()
Exemplo n.º 3
0
class TaggableResource(ModelResource):
    taggabletags = fields.ToManyField(
        'related_resource.api.resources.TaggableTagResource',
        'taggabletags',
        null=True)

    class Meta:
        resource_name = 'taggable'
        queryset = Taggable.objects.all()
        authorization = Authorization()
Exemplo n.º 4
0
class FreshNoteResource(ModelResource):
    media_bits = fields.ToManyField(
        'related_resource.api.resources.FreshMediaBitResource',
        'media_bits',
        related_name='note')

    class Meta:
        queryset = Note.objects.all()
        resource_name = 'freshnote'
        authorization = Authorization()
Exemplo n.º 5
0
class AuthorProfileResource(ModelResource):
    user = fields.ToOneField(UserResource, 'user', full=True)
    sites = fields.ToManyField(SiteResource,
                               'sites',
                               related_name='author_profiles',
                               full=True)

    class Meta:
        queryset = AuthorProfile.objects.all()
        authentication = BasicAuthentication()
        authorization = Authorization()
Exemplo n.º 6
0
class ContactResource(ModelResource):
    groups = fields.ToManyField(ContactGroupResource,
                                'groups',
                                related_name='members',
                                null=True,
                                blank=True)

    class Meta:
        queryset = Contact.objects.prefetch_related('groups')
        resource_name = 'contact'
        authorization = Authorization()
Exemplo n.º 7
0
class OrderResource(ModelResource):
    items = fields.ToManyField(
        "related_resource.api.resources.OrderItemResource",
        "items",
        related_name="order",
        full=True)

    class Meta:
        queryset = Order.objects.all()
        resource_name = 'order'
        authorization = Authorization()
Exemplo n.º 8
0
class ContactGroupResource(ModelResource):
    members = fields.ToManyField(
        'related_resource.api.resources.ContactResource',
        'members',
        related_name='groups',
        null=True,
        blank=True)

    class Meta:
        queryset = ContactGroup.objects.prefetch_related('members')
        resource_name = 'contactgroup'
        authorization = Authorization()
Exemplo n.º 9
0
class DogResource(ModelResource):
    owner = fields.ToOneField(PersonResource, 'owner')
    house = fields.ToOneField(DogHouseResource, 'house', full=True, null=True)
    bones = fields.ToManyField(BoneResource,
                               'bones',
                               full=True,
                               null=True,
                               related_name='dog')

    class Meta:
        queryset = Dog.objects.all()
        resource_name = 'dog'
        authorization = Authorization()
Exemplo n.º 10
0
class PersonResource(ModelResource):
    company = fields.ToOneField(CompanyResource,
                                'company',
                                null=True,
                                full=True)
    dogs = fields.ToManyField('related_resource.api.resources.DogResource',
                              'dogs',
                              full=True,
                              related_name='owner',
                              null=True)

    class Meta:
        queryset = Person.objects.all()
        resource_name = 'person'
        authorization = Authorization()
Exemplo n.º 11
0
class CompanyResource(ModelResource):
    address = fields.ToOneField(AddressResource,
                                'address',
                                null=True,
                                full=True)
    products = fields.ToManyField(ProductResource,
                                  'products',
                                  full=True,
                                  related_name='producer',
                                  null=True)

    class Meta:
        queryset = Company.objects.all()
        resource_name = 'company'
        authorization = Authorization()
Exemplo n.º 12
0
class TagResource(ModelResource):
    taggabletags = fields.ToManyField(
        'related_resource.api.resources.TaggableTagResource',
        'taggabletags',
        null=True)

    extradata = fields.ToOneField(
        'related_resource.api.resources.ExtraDataResource',
        'extradata',
        null=True,
        blank=True,
        full=True)

    class Meta:
        resource_name = 'tag'
        queryset = Tag.objects.all()
        authorization = Authorization()