Skip to content

Instantly share code, notes, and snippets.

@stodge
Forked from bohde/resources.py
Last active August 29, 2015 14:11
Show Gist options
  • Save stodge/f1488c2e1fef03d30c26 to your computer and use it in GitHub Desktop.
Save stodge/f1488c2e1fef03d30c26 to your computer and use it in GitHub Desktop.
class UserResource(ModelResource):
def cached_obj_get(self, request=None, **kwargs):
if request and 'id' in kwargs and kwargs['id'] == 'self':
return request.user
return super(UserResource, self).cached_obj_get(request, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment