summaryrefslogtreecommitdiff
path: root/django/db/models/sql/where.py
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-02-23 04:39:39 +0000
committerJustin Bronn <jbronn@gmail.com>2010-02-23 04:39:39 +0000
commit6ed7bd5609d298858c02d5d3b6357b434df06d9f (patch)
treefd8ddc1916fa72fcf59a974dd9a47fd7925f7ba1 /django/db/models/sql/where.py
parentc1d795df454b9f6500d3b704e68bddd10f0e17eb (diff)
Fixed #12855 -- QuerySets with `extra` where parameters now combine correctly. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/where.py')
-rw-r--r--django/db/models/sql/where.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 4aa2351f17..cf147c6ad9 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -220,7 +220,7 @@ class WhereNode(tree.Node):
child.relabel_aliases(change_map)
elif isinstance(child, tree.Node):
self.relabel_aliases(change_map, child)
- else:
+ elif isinstance(child, (list, tuple)):
if isinstance(child[0], (list, tuple)):
elt = list(child[0])
if elt[0] in change_map:
@@ -254,6 +254,14 @@ class NothingNode(object):
def relabel_aliases(self, change_map, node=None):
return
+class ExtraWhere(object):
+ def __init__(self, sqls, params):
+ self.sqls = sqls
+ self.params = params
+
+ def as_sql(self, qn=None, connection=None):
+ return " AND ".join(self.sqls), tuple(self.params or ())
+
class Constraint(object):
"""
An object that can be passed to WhereNode.add() and knows how to