mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 13:04:03 +03:00
Use custom ListSerializer for pagination if one is specified on the serializer.
This commit is contained in:
parent
80bacc5fb0
commit
03c4eb1130
|
@ -68,7 +68,12 @@ class BasePaginationSerializer(serializers.Serializer):
|
|||
except AttributeError:
|
||||
object_serializer = DefaultObjectSerializer
|
||||
|
||||
self.fields[results_field] = serializers.ListSerializer(
|
||||
try:
|
||||
list_serializer_class = object_serializer.Meta.list_serializer_class
|
||||
except AttributeError:
|
||||
list_serializer_class = serializers.ListSerializer
|
||||
|
||||
self.fields[results_field] = list_serializer_class(
|
||||
child=object_serializer(),
|
||||
source='object_list'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user