Created
January 24, 2014 09:44
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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