[Answered ]-AttributeError: x object has no attribute 'GET' (DRF)

1👍

The first parameter of get_queryset is not a request, but the UserListViewSet, so the self, you can obtain the request with self.request:

class UserListViewSet(viewsets.ModelViewSet):
    serializer_class = UserListSerializer
 
    def get_queryset(self):
        name = self.request.GET.get('username', None)
        return UserList.objects.filter(user=name)

Leave a comment