Changeset 7429
- Timestamp:
- 04/15/08 23:32:56 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/queryset-refactor/django/db/models/sql/query.py
r7426 r7429 536 536 if not already_seen: 537 537 already_seen = set() 538 join_tuple = tuple( joins)538 join_tuple = tuple([self.alias_map[j][TABLE_NAME] for j in joins]) 539 539 if join_tuple in already_seen: 540 540 raise FieldError('Infinite loop caused by ordering.') django/branches/queryset-refactor/tests/regressiontests/queries/models.py
r7418 r7429 111 111 class Meta: 112 112 ordering = ['x'] 113 114 class LoopZ(models.Model): 115 z = models.ForeignKey('self') 116 117 class Meta: 118 ordering = ['z'] 113 119 114 120 __test__ = {'API_TESTS':""" … … 427 433 FieldError: Infinite loop caused by ordering. 428 434 435 >>> LoopZ.objects.all() 436 Traceback (most recent call last): 437 ... 438 FieldError: Infinite loop caused by ordering. 439 429 440 # ... but you can still order in a non-recursive fashion amongst linked fields 430 441 # (the previous test failed because the default ordering was recursive). 431 >>> LoopX.objects.all().order_by('y__x__ id')442 >>> LoopX.objects.all().order_by('y__x__y__x__id') 432 443 [] 433 444
