[Answer]-Is it possible to specify fields of a related resource in tastypie

1👍

The common way is to create one more resource, say, SafePostResource below PostResource:

class SafePostResource(PostResource):
    class Meta(PostResource.Meta):
        fields = ['field_one', 'field_two']


class ReaderResource(common.Resource)
    posts = fields.ToManyField('SafePostResource', 'post_set', full=True, null=True)

    class Meta:
        queryset = models.Reader.objects.all()

without registering that resource.

Notice that creating related resource is not always easy, but Django Tastypie makes everything easier.

Leave a comment