Skip to content

Instantly share code, notes, and snippets.

@amccloud
Created May 3, 2012 11:06
Show Gist options
  • Save amccloud/2585028 to your computer and use it in GitHub Desktop.
Save amccloud/2585028 to your computer and use it in GitHub Desktop.
class MultipartResource(object):
def deserialize(self, request, data, format=None):
if not format:
format = request.META.get('CONTENT_TYPE', 'application/json')
if format == 'application/x-www-form-urlencoded':
return request.POST
if format.startswith('multipart'):
data = request.POST.copy()
data.update(request.FILES)
return data
return super(MultipartResource, self).deserialize(request, data, format)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment