django-rest-framework icon indicating copy to clipboard operation
django-rest-framework copied to clipboard

Added request param to paginate_queryset in ListModelMixin

Open abronets opened this issue 2 years ago • 2 comments

In standard PageNumberPagination, paginate_queryset requires request, so this method in ListModelMixin is to be rewritten every time:

def paginate_queryset(self, queryset): return super().paginate_queryset(queryset, self.request)

This code fixes this bug

abronets avatar Aug 24 '23 11:08 abronets

The .paginate_queryset which the ListModelMixin is expecting is that of GenericAPIView not any of a pagination class.

https://github.com/encode/django-rest-framework/blob/5a01a4c8a900a98ca0186b742d03d02c55846632/rest_framework/generics.py#L169-L175

This is not required.

TL; DR: mixins are to be used with views/viewsset.

sevdog avatar Sep 05 '23 10:09 sevdog

I guess we can close this

auvipy avatar Sep 09 '23 08:09 auvipy