Skip to content

Instantly share code, notes, and snippets.

@ratpik
Created January 24, 2014 09:44
Show Gist options
  • Save ratpik/8594641 to your computer and use it in GitHub Desktop.
Save ratpik/8594641 to your computer and use it in GitHub Desktop.
Add this to the tastypie model to extend the modelresource with other nested resources
def dehydrate(self, bundle):
x = bundle.obj.get_x()
ur = UserResource()
ur_bundle = ur.build_bundle(obj=x, request=bundle.request)
bundle.data['x'] = ur.full_dehydrate(ur_bundle)
return bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment