summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/where.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 0bc3638b80..5515bc4f83 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -4,6 +4,7 @@ Code to manage the creation and SQL rendering of 'where' constraints.
from __future__ import absolute_import
+import collections
import datetime
from itertools import repeat
@@ -49,7 +50,7 @@ class WhereNode(tree.Node):
return
obj, lookup_type, value = data
- if hasattr(value, '__iter__') and hasattr(value, 'next'):
+ if isinstance(value, collections.Iterator):
# Consume any generators immediately, so that we can determine
# emptiness and transform any non-empty values correctly.
value = list(value)