Update serializers.py

Treat the input queryset as it comes (maybe it has been changed in a higher level). Evaluating .all() does nothing if or if not is a queryset.
This commit is contained in:
Julio Iván Alegre 2014-12-09 16:13:18 +01:00
parent f5b783af61
commit 8d6b0b1f2d

View File

@ -517,9 +517,8 @@ class ListSerializer(BaseSerializer):
"""
List of object instances -> List of dicts of primitive datatypes.
"""
iterable = data.all() if (hasattr(data, 'all')) else data
return [
self.child.to_representation(item) for item in iterable
self.child.to_representation(item) for item in data
]
def validate(self, attrs):