mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Merge pull request #2331 from tomchristie/use-custom-list-serializer-for-pagination
Use custom ListSerializer for pagination if required.
This commit is contained in:
commit
e4c7c10b00
|
@ -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