Set many explicitly from mixins. Refs #564.

This commit is contained in:
Tom Christie 2013-02-06 13:04:11 +00:00
parent cc2ec2bbf0
commit 55fd646631
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class GenericAPIView(views.APIView):
return serializer_class return serializer_class
def get_serializer(self, instance=None, data=None, def get_serializer(self, instance=None, data=None,
files=None, partial=False): files=None, partial=False, many=False):
""" """
Return the serializer instance that should be used for validating and Return the serializer instance that should be used for validating and
deserializing input, and for serializing output. deserializing input, and for serializing output.
@ -56,7 +56,7 @@ class GenericAPIView(views.APIView):
serializer_class = self.get_serializer_class() serializer_class = self.get_serializer_class()
context = self.get_serializer_context() context = self.get_serializer_context()
return serializer_class(instance, data=data, files=files, return serializer_class(instance, data=data, files=files,
partial=partial, context=context) many=many, partial=partial, context=context)
class MultipleObjectAPIView(MultipleObjectMixin, GenericAPIView): class MultipleObjectAPIView(MultipleObjectMixin, GenericAPIView):

View File

@ -65,7 +65,7 @@ class ListModelMixin(object):
paginator, page, queryset, is_paginated = packed paginator, page, queryset, is_paginated = packed
serializer = self.get_pagination_serializer(page) serializer = self.get_pagination_serializer(page)
else: else:
serializer = self.get_serializer(self.object_list) serializer = self.get_serializer(self.object_list, many=True)
return Response(serializer.data) return Response(serializer.data)