Django Rest Framework: Pagination Not Working as Expected with Custom Serializer
I'm refactoring my project and I'm using Django Rest Framework (DRF) to build an API that returns a paginated list of items. I've set up a custom serializer, but when I try to paginate the results, it seems to return the entire list instead of the expected page size. I have the following setup: ```python from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from rest_framework import viewsets from .models import Item from .serializers import ItemSerializer class CustomPagination(PageNumberPagination): page_size = 10 class ItemViewSet(viewsets.ModelViewSet): queryset = Item.objects.all() serializer_class = ItemSerializer pagination_class = CustomPagination ``` When I make a request to my API endpoint, it returns all items instead of just the first page of 10. I can see that the `CustomPagination` class is being used because I see the pagination headers in the response, but the items array includes all items. I've checked the settings for pagination in `settings.py` and confirmed that my `DEFAULT_PAGINATION_CLASS` is set to `CustomPagination`. However, I still end up receiving all items in the response: ```json { "count": 50, "next": "http://localhost:8000/api/items/?page=2", "previous": null, "results": [ {...}, {...}, ... // all 50 items returned ] } ``` I've also tried manually adding `?page=1` to the URL, but the behavior remains the same. Any ideas why this could be happening? Am I missing something in my setup? Is there something specific about the serializer that might be affecting pagination? I am using Django 3.2 and DRF 3.12.