summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-11-17 16:47:46 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-11-17 16:47:46 +0000
commit1aaf270d73e42b28edace569575712cb2cbf1ef6 (patch)
tree17cf5903f1f77b01c65b80b67b1c6053f33be565 /django/db/models/sql/query.py
parent6469eec71d9d82d8be2ac62a128273426d78ab5b (diff)
[1.2.X] Fixed #14423 -- corrected incorrect SQL being generated when a nullable, inherited field was used in an exclude. Thanks to PhiR_42 for the patch. Backport of [14600].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index c0449e7047..b8638fe909 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -921,8 +921,7 @@ class Query(object):
"""
opts = model._meta
field_list = aggregate.lookup.split(LOOKUP_SEP)
- if (len(field_list) == 1 and
- aggregate.lookup in self.aggregates.keys()):
+ if len(field_list) == 1 and aggregate.lookup in self.aggregates:
# Aggregate is over an annotation
field_name = field_list[0]
col = field_name
@@ -1090,11 +1089,14 @@ class Query(object):
if self.alias_map[alias][JOIN_TYPE] == self.LOUTER:
j_col = self.alias_map[alias][RHS_JOIN_COL]
entry = self.where_class()
- entry.add((Constraint(alias, j_col, None), 'isnull', True), AND)
+ entry.add(
+ (Constraint(alias, j_col, None), 'isnull', True),
+ AND
+ )
entry.negate()
self.where.add(entry, AND)
break
- elif not (lookup_type == 'in'
+ if not (lookup_type == 'in'
and not hasattr(value, 'as_sql')
and not hasattr(value, '_as_sql')
and not value) and field.null: