mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
change ListSerializer
's all to iterator. Under a lot of data, the iterator
better than all
This commit is contained in:
parent
9d001cd84c
commit
483995878a
|
@ -677,7 +677,7 @@ class ListSerializer(BaseSerializer):
|
||||||
"""
|
"""
|
||||||
# Dealing with nested relationships, data can be a Manager,
|
# Dealing with nested relationships, data can be a Manager,
|
||||||
# so, first get a queryset from the Manager if needed
|
# so, first get a queryset from the Manager if needed
|
||||||
iterable = data.all() if isinstance(data, models.Manager) else data
|
iterable = data.iterator() 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user