Changeset 7761
- Timestamp:
- 06/26/08 01:50:22 (5 months ago)
- Files:
-
- django/trunk/django/db/models/sql/query.py (modified) (1 diff)
- django/trunk/tests/regressiontests/queries/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/sql/query.py
r7760 r7761 611 611 col = target.column 612 612 613 # Must use left outer joins for nullable fields. 614 for join in joins: 615 self.promote_alias(join) 616 613 617 # If we get to this point and the field is a relation to another model, 614 618 # append the default ordering for that model. django/trunk/tests/regressiontests/queries/models.py
r7760 r7761 500 500 # ForeignKey) is legal, but the results might not make sense. That isn't 501 501 # Django's problem. Garbage in, garbage out. 502 >>> Item.objects. all().order_by('tags', 'id')502 >>> Item.objects.filter(tags__isnull=False).order_by('tags', 'id') 503 503 [<Item: one>, <Item: two>, <Item: one>, <Item: two>, <Item: four>] 504 504 … … 763 763 [<Tag: t1>, <Tag: t4>, <Tag: t5>] 764 764 765 Bug #7181 -- ordering by related tables should accomodate nullable fields (this 766 test is a little tricky, since NULL ordering is database dependent. Instead, we 767 just count the number of results). 768 >>> len(Tag.objects.order_by('parent__name')) 769 5 770 765 771 """} 766 772
