mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Use explicit many=True for object_serializer instantiation in PaginationSerializer and add catch dummy 'many' kwarg on DefaultObjectSerializer
This commit is contained in:
parent
deb19272b7
commit
9195ccb97f
|
@ -43,8 +43,9 @@ class DefaultObjectSerializer(serializers.Field):
|
|||
as the default.
|
||||
"""
|
||||
|
||||
def __init__(self, source=None, context=None):
|
||||
# Note: Swallow context kwarg - only required for eg. ModelSerializer.
|
||||
def __init__(self, source=None, many=None, context=None):
|
||||
# Note: Swallow context and many kwargs - only required for
|
||||
# eg. ModelSerializer.
|
||||
super(DefaultObjectSerializer, self).__init__(source=source)
|
||||
|
||||
|
||||
|
@ -82,7 +83,10 @@ class BasePaginationSerializer(serializers.Serializer):
|
|||
else:
|
||||
context_kwarg = {}
|
||||
|
||||
self.fields[results_field] = object_serializer(source='object_list', **context_kwarg)
|
||||
print object_serializer
|
||||
self.fields[results_field] = object_serializer(source='object_list',
|
||||
many=True,
|
||||
**context_kwarg)
|
||||
|
||||
|
||||
class PaginationSerializer(BasePaginationSerializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user