mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
pass many=False to pagination_serializer_class()
pagination serializers should always have many=False set, otherwise they'll be passed the individual objects of the page rather than the page object itself. this is a real/better fix for #1186. removes the need for the deprecated isinstance Page check, though it's left in place since it doesn't hurt anything.
This commit is contained in:
parent
f92d8bd972
commit
d61f541d35
|
@ -111,7 +111,8 @@ class GenericAPIView(views.APIView):
|
||||||
|
|
||||||
pagination_serializer_class = SerializerClass
|
pagination_serializer_class = SerializerClass
|
||||||
context = self.get_serializer_context()
|
context = self.get_serializer_context()
|
||||||
return pagination_serializer_class(instance=page, context=context)
|
return pagination_serializer_class(instance=page, context=context,
|
||||||
|
many=False)
|
||||||
|
|
||||||
def paginate_queryset(self, queryset, page_size=None):
|
def paginate_queryset(self, queryset, page_size=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user