I fixed this by creating my own pagination class. and setting the desired pages in the classroom. I used this class as pagination_class in my view.
class ExamplePagination(pagination.PageNumberPagination): page_size = 2 class HobbyCategoryViewSet(viewsets.ModelViewSet): serializer_class = HobbyCategorySerializer queryset = UserHobbyCategory.objects.all() pagination_class=ExamplePagination
I am not sure if there is an easier way for this. this one worked for me. But I think it is not good to create a new class, just to change page_size.
Change - a simple solution sets it as
pagination.PageNumberPagination.page_size = 100
in the ViewSet.
class HobbyCategoryViewSet(viewsets.ModelViewSet): serializer_class = HobbyCategorySerializer queryset = UserHobbyCategory.objects.all() pagination.PageNumberPagination.page_size = 100
source share