summaryrefslogtreecommitdiff
path: root/django/db/models/sql/where.py
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-02-23 05:59:04 +0000
committerJustin Bronn <jbronn@gmail.com>2010-02-23 05:59:04 +0000
commit6a28f581c0fec79f387fa10dddb9bdc8594a03d6 (patch)
tree29808669e68cd49bd8fb94765f10822351641221 /django/db/models/sql/where.py
parent16efc1a92e30e5f8a9ecc89edf0002db2425b3b4 (diff)
Fixed #12855 -- QuerySets? with extra where parameters now combine correctly. Thanks, Alex Gaynor.
Backport of r12502 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12507 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 ec0545ca5b..9ae5e74c42 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -216,7 +216,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:
@@ -249,6 +249,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):
+ 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