Merge pull request #2331 from tomchristie/use-custom-list-serializer-for-pagination

Use custom ListSerializer for pagination if required.
This commit is contained in:
Tom Christie 2014-12-20 16:42:39 +00:00
commit e4c7c10b00

View File

@ -68,7 +68,12 @@ class BasePaginationSerializer(serializers.Serializer):
except AttributeError: except AttributeError:
object_serializer = DefaultObjectSerializer 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(), child=object_serializer(),
source='object_list' source='object_list'
) )