From 6ed7bd5609d298858c02d5d3b6357b434df06d9f Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Tue, 23 Feb 2010 04:39:39 +0000 Subject: 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 --- django/db/models/sql/where.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'django/db/models/sql/where.py') 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 -- cgit v1.3