summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/db/models/sql/where.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 662d99a4a2..277ccef4f2 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -43,6 +43,10 @@ class WhereNode(tree.Node):
return
alias, col, field, lookup_type, value = data
+ if hasattr(value, '__iter__') and hasattr(value, 'next'):
+ # Consume any generators immediately, so that we can determine
+ # emptiness and transform any non-empty values correctly.
+ value = list(value)
try:
if field:
params = field.get_db_prep_lookup(lookup_type, value)