Skip to content

Instantly share code, notes, and snippets.

@derks
Created November 15, 2011 01:34
Show Gist options
  • Save derks/1365835 to your computer and use it in GitHub Desktop.
Save derks/1365835 to your computer and use it in GitHub Desktop.
class UserResource(ModelResource):
class Meta:
queryset = db.User.objects.all()
authentication = ApiKeyPlusWebAuthentication()
authorization = DjangoAuthorization()
resource_name = 'user'
excludes = ['email', 'password', 'is_active', 'is_staff', 'is_superuser']
filtering = {}
allowed_methods = ['get']
def override_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment