I've been following the django-rest-framework documentation examples but I'm having trouble getting pagination to work when using a `ListModelMixin and viewsets.GenericViewset
This does NOT paginate:
class InvitesViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
permission_classes = [IsAuthenticated]
queryset = User.objects.all()
serializer_class = UserSerializer
def list(self, request):
invited_users = self.get_queryset() # just did this as a test
serializer = UserSerializer(invited_users, many=True)
return Response(serializer.data)
While this does:
class InvitesViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
permission_classes = [IsAuthenticated]
queryset = User.objects.all()
serializer_class = UserSerializer
How can I return a custom list response (because I need to filter on the request.user) with pagination while using ListModelMixin?