1
1
mirror of https://github.com/encode/django-rest-framework.git synced 2025-07-28 00:49:49 +03:00
This commit is contained in:
Tom Christie 2014-12-10 12:29:01 +00:00
commit 6f434a67e7

View File

@ -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
] ]