Skip to content

Instantly share code, notes, and snippets.

@bohde
Created May 18, 2011 14:19
Show Gist options
  • Save bohde/978657 to your computer and use it in GitHub Desktop.
Save bohde/978657 to your computer and use it in GitHub Desktop.
Example of ToMany resources in Django Tastypie
v1_api = Api(api_name='v1')
v1_api.register(BookResource())
# Intentionally left out PageResource
class PageResource(ModelResource):
class Meta:
queryset = Page.objects.all()
include_resource_uri = False
class BookResource(ModelResource):
pages = ToManyField(PageResource, 'page_set', full=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment