Skip to content

Instantly share code, notes, and snippets.

@natea
Created June 8, 2011 01:02
Show Gist options
  • Save natea/1013576 to your computer and use it in GitHub Desktop.
Save natea/1013576 to your computer and use it in GitHub Desktop.
class CardResource(ModelResource):
...
def post_list(self, request, **kwargs):
deserialized = self.deserialize(request, request.raw_post_data, \
format=request.META.get('CONTENT_TYPE', 'application/json'))
bundle = self.build_bundle(data=dict_strip_unicode_keys(deserialized))
self.is_valid(bundle, request)
updated_bundle = self.obj_create(bundle, request=request, user=request.user)
updated_bundle.obj.get_tracks()
updated_bundle.obj.get_track_urls()
return self.create_response(request, self.full_dehydrate(bundle.obj))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment