Commit fb313f80 by Tom Christie

Merge pull request #2241 from IvanAlegre/patch-1

Update serializers.py
parents 81d0b748 428630c1
...@@ -517,7 +517,9 @@ class ListSerializer(BaseSerializer): ...@@ -517,7 +517,9 @@ class ListSerializer(BaseSerializer):
""" """
List of object instances -> List of dicts of primitive datatypes. List of object instances -> List of dicts of primitive datatypes.
""" """
iterable = data.all() if (hasattr(data, 'all')) else data # Dealing with nested relationships, data can be a Manager,
# so, first get a queryset from the Manager if needed
iterable = data.all() if isinstance(data, models.Manager) else data
return [ return [
self.child.to_representation(item) for item in iterable self.child.to_representation(item) for item in iterable
] ]
......
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