Skip to content

Commit

Permalink
Force-evaluate querysets (see #2602)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Feb 25, 2015
1 parent 5688d8b commit 6aff923
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def to_representation(self, 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
iterable = data.all() if isinstance(data, (models.Manager, models.QuerySet)) else data
return [
self.child.to_representation(item) for item in iterable
]
Expand Down

0 comments on commit 6aff923

Please sign in to comment.