mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
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:
parent
f5b783af61
commit
8d6b0b1f2d
|
@ -517,9 +517,8 @@ 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
|
|
||||||
return [
|
return [
|
||||||
self.child.to_representation(item) for item in iterable
|
self.child.to_representation(item) for item in data
|
||||||
]
|
]
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user