diff options
| author | Tom Christie | 2014-12-10 12:29:01 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-10 12:29:01 +0000 |
| commit | 6f434a67e78311e0a2d3d646b59d6bd64f65a776 (patch) | |
| tree | 989c76683c5c5b92c70151848d567101c2e43d26 | |
| parent | dafc5d45a01da2ba212eb89d4470405ea429ed2a (diff) | |
| parent | fb313f80983530efcb6e5bbdcff68c98d1e68cc4 (diff) | |
| download | django-rest-framework-6f434a67e78311e0a2d3d646b59d6bd64f65a776.tar.bz2 | |
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
| -rw-r--r-- | rest_framework/serializers.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index b0c0efa7..9226895e 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -517,7 +517,9 @@ class ListSerializer(BaseSerializer): """ List of object instances -> List of dicts of primitive datatypes. """ - iterable = data.all() if (hasattr(data, 'all')) else 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 return [ self.child.to_representation(item) for item in iterable ] |
