diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 12:59:50 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 12:59:50 +0000 |
| commit | 6c507a5cd4e1f1752ce163023000065842764274 (patch) | |
| tree | 221cbbb600e71e5bec4b957903d83e6adeb146a7 /django/db/models/sql/query.py | |
| parent | 9b2ac2ad2d7f17e65da1a3e719f3da5962923cfd (diff) | |
[1.1.X] Fixed #12240 - select_related doesn't work correctly when mixing nullable and non-nullable keys
Thanks to embe for report and Alex for fix.
Backport of 12719 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 36a83036a9..6b9f4b6d56 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1361,10 +1361,7 @@ class BaseQuery(object): avoid = avoid_set.copy() dupe_set = orig_dupe_set.copy() table = f.rel.to._meta.db_table - if nullable or f.null: - promote = True - else: - promote = False + promote = nullable or f.null if model: int_opts = opts alias = root_alias @@ -1415,10 +1412,7 @@ class BaseQuery(object): next = requested.get(f.name, {}) else: next = False - if f.null is not None: - new_nullable = f.null - else: - new_nullable = None + new_nullable = f.null or promote for dupe_opts, dupe_col in dupe_set: self.update_dupe_avoidance(dupe_opts, dupe_col, alias) self.fill_related_selections(f.rel.to._meta, alias, cur_depth + 1, |
