summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 2546d6c889..43ba519a68 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1445,8 +1445,7 @@ class Query(object):
the join.
"""
for info in reversed(path):
- direct = info.join_field == info.from_field
- if info.to_field == target and direct:
+ if info.to_field == target and info.direct:
target = info.from_field
self.unref_alias(joins.pop())
else: