From d61f541d35075ee93ab359b779b3df3595c2df9b Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Tue, 22 Oct 2013 07:35:21 -0700 Subject: [PATCH] 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. --- rest_framework/generics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/generics.py b/rest_framework/generics.py index 6d204cf5f..e925b7a8d 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -111,7 +111,8 @@ class GenericAPIView(views.APIView): pagination_serializer_class = SerializerClass 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): """