mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-13 05:06:58 +03:00
refactor: remove user API methods parameter
`methods` defaults to ["GET"] if not specified. There is no need to
explicitly set this in the action.
71e6c30034/rest_framework/decorators.py (L145)
This commit is contained in:
parent
4cd205b19c
commit
8483bbbdf2
|
@ -19,7 +19,7 @@ class UserViewSet(RetrieveModelMixin, ListModelMixin, UpdateModelMixin, GenericV
|
||||||
assert isinstance(self.request.user.id, int)
|
assert isinstance(self.request.user.id, int)
|
||||||
return self.queryset.filter(id=self.request.user.id)
|
return self.queryset.filter(id=self.request.user.id)
|
||||||
|
|
||||||
@action(detail=False, methods=["GET"])
|
@action(detail=False)
|
||||||
def me(self, request):
|
def me(self, request):
|
||||||
serializer = UserSerializer(request.user, context={"request": request})
|
serializer = UserSerializer(request.user, context={"request": request})
|
||||||
return Response(status=status.HTTP_200_OK, data=serializer.data)
|
return Response(status=status.HTTP_200_OK, data=serializer.data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user