Skip to content

Commit

Permalink
review-fix-2. Bugfix in CustomUserViewSet, api/users/ now returns lis…
Browse files Browse the repository at this point in the history
…t of users with limit filter. Had to change queryset (see the Ñsourcecode forUserViewSet get_queryset)
  • Loading branch information
Resistor-git committed Sep 26, 2023
1 parent 7706682 commit 4774a86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@


class CustomUserViewSet(UserViewSet):
queryset = User.objects.all()
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
pagination_class = CustomLimitPagination

def get_serializer_class(self):
if (self.request.method in permissions.SAFE_METHODS
and self.request.user.is_authenticated):
return CustomUserRetrieveSerializer
return super().get_serializer_class()

def get_queryset(self):
queryset = User.objects.all()
return queryset

@action(
methods=['POST', 'DELETE'],
detail=True,
Expand Down

0 comments on commit 4774a86

Please sign in to comment.