diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-02-20 21:52:44 +0200 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-02-20 21:57:39 +0200 |
| commit | 8ad436636fd385abd144274952b0c066885af042 (patch) | |
| tree | 45d9d45463876519852d971cf71f62c4d620b799 /django/db/models/sql | |
| parent | 8d4342f2c97db93c54a1a5fef26a526caac62df1 (diff) | |
[1.5.x] Fixed #19672 -- Error in negated Q() filtering
There was a variable overwrite error in negated join filtering. This
happened when add_filter() was adding the IS NULL condition to the
WHERE clause.
This is not a backport from master as there have been some other
refactorings which made this patch irrelevant.
The patch is from Ian Kelly.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 9c2af10e35..e7c8d6caaf 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1193,15 +1193,15 @@ class Query(object): self.promote_joins(join_list) if lookup_type != 'isnull': if len(join_list) > 1: - for alias in join_list: - if self.alias_map[alias].join_type == self.LOUTER: - j_col = self.alias_map[alias].rhs_join_col + for j_alias in join_list: + if self.alias_map[j_alias].join_type == self.LOUTER: + j_col = self.alias_map[j_alias].rhs_join_col # The join promotion logic should never produce # a LOUTER join for the base join - assert that. assert j_col is not None entry = self.where_class() entry.add( - (Constraint(alias, j_col, None), 'isnull', True), + (Constraint(j_alias, j_col, None), 'isnull', True), AND ) entry.negate() |
