From 8d6b0b1f2d3a5014d43f1314d96bc9197709b542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20Iv=C3=A1n=20Alegre?= Date: Tue, 9 Dec 2014 16:13:18 +0100 Subject: [PATCH] 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. --- rest_framework/serializers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index b0c0efa7c..5c73c5f25 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -517,9 +517,8 @@ class ListSerializer(BaseSerializer): """ List of object instances -> List of dicts of primitive datatypes. """ - iterable = data.all() if (hasattr(data, 'all')) else data return [ - self.child.to_representation(item) for item in iterable + self.child.to_representation(item) for item in data ] def validate(self, attrs):