summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2012-04-09 00:43:08 +0000
committerJulien Phalip <jphalip@gmail.com>2012-04-09 00:43:08 +0000
commit93d1fdb1304ed5b2e5ea2e0f1e84db7fff5eb7fa (patch)
tree908a45af91a033e5b0508ed06ab1f73e52a3dff1 /django/db
parent5c53e30607014163872e89c221b206992a9acfef (diff)
Fixed #17877 -- Ensured that extra WHERE clauses get correctly ANDed when they contain OR operations. Thanks to Marek Brzóska for the report, to eleather for the test case and to Adrien Lemaire for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
-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 2bd705dd60..0bc3638b80 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -281,7 +281,8 @@ class ExtraWhere(object):
self.params = params
def as_sql(self, qn=None, connection=None):
- return " AND ".join(self.sqls), tuple(self.params or ())
+ sqls = ["(%s)" % sql for sql in self.sqls]
+ return " AND ".join(sqls), tuple(self.params or ())
class Constraint(object):
"""