aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/relations.py
diff options
context:
space:
mode:
authorTom Christie2014-10-08 16:43:33 +0100
committerTom Christie2014-10-08 16:43:33 +0100
commit4c015df28cfb7dc7cf29f6dc4985c57e1f5cdc5d (patch)
tree70efb10249951de0af6b99e1287da0271b789246 /rest_framework/relations.py
parent14ae52a24e93063f77c6010269bf9cd3316627fe (diff)
downloaddjango-rest-framework-4c015df28cfb7dc7cf29f6dc4985c57e1f5cdc5d.tar.bz2
Tweaks
Diffstat (limited to 'rest_framework/relations.py')
-rw-r--r--rest_framework/relations.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py
index df5025b8..e9dd7dde 100644
--- a/rest_framework/relations.py
+++ b/rest_framework/relations.py
@@ -264,9 +264,10 @@ class ManyRelation(Field):
]
def to_representation(self, obj):
+ iterable = obj.all() if (hasattr(obj, 'all')) else obj
return [
self.child_relation.to_representation(value)
- for value in obj.all()
+ for value in iterable
]
@property