Commit 59470667 by J. Iván Alegre

Take in care that input data in serializer can be a Manager

parent 8d6b0b1f
......@@ -517,8 +517,9 @@ class ListSerializer(BaseSerializer):
"""
List of object instances -> List of dicts of primitive datatypes.
"""
iterable = data.all() if (isinstance(data, models.Manager) and hasattr(data, 'all')) else data
return [
self.child.to_representation(item) for item in data
self.child.to_representation(item) for item in iterable
]
def validate(self, attrs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment