diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-11 08:23:51 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-11 08:23:51 +0000 |
| commit | f3ed30f377051c3fef3d184241ed5271fbe61854 (patch) | |
| tree | 9002ad05abfcd6add32b54318a750674bfd9a588 /django/db/models/sql | |
| parent | 3176bebffd7a7e3ba131da2d1b3f9776e159f0a8 (diff) | |
queryset-refactor: Infinite loop detection in model ordering was being a little
too aggressive. Fixed that.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 7d24701438..491e5b2f5b 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -518,14 +518,14 @@ class Query(object): # If we get to this point and the field is a relation to another model, # append the default ordering for that model. - if len(joins) > 1 and opts.ordering: + if field.rel and len(joins) > 1 and opts.ordering: # Firstly, avoid infinite loops. if not already_seen: - already_seen = {} + already_seen = set() join_tuple = tuple([tuple(j) for j in joins]) if join_tuple in already_seen: raise FieldError('Infinite loop caused by ordering.') - already_seen[join_tuple] = True + already_seen.add(join_tuple) results = [] for item in opts.ordering: |
