diff options
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index a711103485..ec0545ca5b 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -47,6 +47,10 @@ class WhereNode(tree.Node): return obj, 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) if hasattr(obj, "process"): try: obj, params = obj.process(lookup_type, value) |
