mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Set many explicitly from mixins. Refs #564.
This commit is contained in:
parent
cc2ec2bbf0
commit
55fd646631
|
@ -48,7 +48,7 @@ class GenericAPIView(views.APIView):
|
|||
return serializer_class
|
||||
|
||||
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
|
||||
deserializing input, and for serializing output.
|
||||
|
@ -56,7 +56,7 @@ class GenericAPIView(views.APIView):
|
|||
serializer_class = self.get_serializer_class()
|
||||
context = self.get_serializer_context()
|
||||
return serializer_class(instance, data=data, files=files,
|
||||
partial=partial, context=context)
|
||||
many=many, partial=partial, context=context)
|
||||
|
||||
|
||||
class MultipleObjectAPIView(MultipleObjectMixin, GenericAPIView):
|
||||
|
|
|
@ -65,7 +65,7 @@ class ListModelMixin(object):
|
|||
paginator, page, queryset, is_paginated = packed
|
||||
serializer = self.get_pagination_serializer(page)
|
||||
else:
|
||||
serializer = self.get_serializer(self.object_list)
|
||||
serializer = self.get_serializer(self.object_list, many=True)
|
||||
|
||||
return Response(serializer.data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user