From b44ed404c78e93e6afea0b011eead327e65fbd2f Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 19 Apr 2015 02:06:17 -0400 Subject: Fixed #24654 -- Based ordering circular references detection on columns. Thanks to Elmar Bucher for the report and Tim for the review. --- django/db/models/sql/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index b70a15755b..7ada8e85d0 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -567,7 +567,7 @@ class SQLCompiler(object): # Firstly, avoid infinite loops. if not already_seen: already_seen = set() - join_tuple = tuple(self.query.alias_map[j].table_name for j in joins) + join_tuple = tuple(getattr(self.query.alias_map[j], 'join_cols', None) for j in joins) if join_tuple in already_seen: raise FieldError('Infinite loop caused by ordering.') already_seen.add(join_tuple) -- cgit v1.3