diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 12:47:16 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 12:47:16 +0000 |
| commit | 5e3a2e2f3956f358b5e82e217c20bb0b36fb0665 (patch) | |
| tree | 106f3a359a5746bcc76d06cf7a001fa502c13102 /django/db/models/sql/compiler.py | |
| parent | 40c022c91e8f5176a01a23c6dac8d938b8fa3a93 (diff) | |
Fixed #12240 - select_related doesn't work correctly when mixing nullable and non-nullable keys
Thanks to embe for report and Alex for fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12719 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/compiler.py')
| -rw-r--r-- | django/db/models/sql/compiler.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index f364b1de82..b7d63d381e 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -530,10 +530,7 @@ class SQLCompiler(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 @@ -584,10 +581,7 @@ class SQLCompiler(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.query.update_dupe_avoidance(dupe_opts, dupe_col, alias) self.fill_related_selections(f.rel.to._meta, alias, cur_depth + 1, |
