diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-12-17 00:43:33 +0200 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-12-30 11:18:25 +0200 |
| commit | 9ef3cab40b1806d99172e94954976413f860a476 (patch) | |
| tree | 379e43e693fd2fc7d790cf60c27d5d701c54f153 /django/db/models/sql/query.py | |
| parent | a04df803a590c5bffd9437d9199bc0107ba0e966 (diff) | |
Made sure join_field is always available in .join()
Refs #19385
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index c71bc634aa..841452636b 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -944,6 +944,7 @@ class Query(object): The 'join_field' is the field we are joining along (if any). """ lhs, table, lhs_col, col = connection + assert lhs is None or join_field is not None existing = self.join_map.get(connection, ()) if reuse is None: reuse = existing @@ -1003,8 +1004,9 @@ class Query(object): for field, model in opts.get_fields_with_model(): if model not in seen: link_field = opts.get_ancestor_link(model) - seen[model] = self.join((root_alias, model._meta.db_table, - link_field.column, model._meta.pk.column)) + seen[model] = self.join( + (root_alias, model._meta.db_table, link_field.column, + model._meta.pk.column), join_field=link_field) self.included_inherited_models = seen def remove_inherited_models(self): |
