Skip to content

Instantly share code, notes, and snippets.

@jazztpt
Created June 7, 2011 22:54
Show Gist options
  • Save jazztpt/1013375 to your computer and use it in GitHub Desktop.
Save jazztpt/1013375 to your computer and use it in GitHub Desktop.
Valentunes api post_list
def post_list(self, request, **kwargs):
"""
Creates a new resource/object with the provided data.
Calls get_tracks to get all track info from various apis.
"""
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