summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAric Coady <aric.coady@gmail.com>2015-04-27 15:23:56 -0700
committerTim Graham <timograham@gmail.com>2015-04-28 10:51:27 -0400
commit9c2d8cde77ee6edd407e92f93eacd4624290394f (patch)
tree8d699d9ac2ab6580439c62a9b7dbcb6bd5f7f87d /django
parenteaeea6f94701547ce1b50dbcf5cf71460e9e4c91 (diff)
Fixed #24719 -- Restored the ability to use interators as queryset related object filters.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index b514cc4783..d84e3aa681 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -8,7 +8,7 @@ all about the internals of models in order to get the information it needs.
"""
import copy
import warnings
-from collections import Mapping, OrderedDict
+from collections import Iterator, Mapping, OrderedDict
from itertools import chain, count, product
from string import ascii_uppercase
@@ -1148,6 +1148,9 @@ class Query(object):
field, sources, opts, join_list, path = self.setup_joins(
parts, opts, alias, can_reuse=can_reuse, allow_many=allow_many)
+ # Prevent iterator from being consumed by check_related_objects()
+ if isinstance(value, Iterator):
+ value = list(value)
self.check_related_objects(field, value, opts)
# split_exclude() needs to know which joins were generated for the