diff options
| author | Daniel Hillier <daniel.hillier@gmail.com> | 2016-12-14 01:06:54 +1100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-14 07:46:27 -0500 |
| commit | 7da37699e8d7124f5d0cfaba931772333c24ef83 (patch) | |
| tree | 416845e44257ba07ef9cc9c7cb48a787249dc2d5 /django/db/models/sql | |
| parent | 2e9fa516fde57fd58405481034a5a08b3746b257 (diff) | |
Fixed #27594 -- Fixed select_related() with reverse self-referential OneToOneField.
Fixed definition of `klass_info['from_parent']` so that two models aren't
considered from a parent class if the model classes are the same.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index c7455ecceb..3e61f8a925 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -713,7 +713,7 @@ class SQLCompiler(object): _, _, _, joins, _ = self.query.setup_joins([related_field_name], opts, root_alias) alias = joins[-1] - from_parent = issubclass(model, opts.model) + from_parent = issubclass(model, opts.model) and model is not opts.model klass_info = { 'model': model, 'field': f, |
