I have a UserResource defined as:
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
resource_name = 'user'
# No one is allowed to see all users
list_allowed_methods = []
detail_allowed_methods = ['get', 'put', 'patch']
# Hide staff
excludes = ('is_staff')
def apply_authorization_limits(self, request, object_list):
return object_list.filter(pk=request.user.pk)
def prepend_urls(self):
return [ url(r'^(?P<resource_name>%s)/$' % self._meta.resource_name, self.wrap_view('dispatch_detail'), name='api_dispatch_detail') ]
I want URI /user/ to return just current user's details, no list at all. My solution gives "more than one resource found at this uri" error, and indeed dispatch_list is there as well. How can I have /user/ return and handle only current user's details?
Thanks