1
0
mirror of https://github.com/django/django.git synced 2025-07-05 10:19:20 +00:00

queryset-refactored: Added a test to show that ordering on multi-valued fields

might not be what is expected.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7286 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-03-18 10:33:37 +00:00
parent 670be13986
commit 67cc3cec90

View File

@ -426,8 +426,8 @@ FieldError: Infinite loop caused by ordering.
# Ordering by a many-valued attribute (e.g. a many-to-many or reverse
# ForeignKey) is legal, but the results might not make sense. That isn't
# Django's problem. Garbage in, garbage out.
>>> Item.objects.all().order_by('tags')
[...]
>>> Item.objects.all().order_by('tags', 'id')
[<Item: one>, <Item: two>, <Item: one>, <Item: two>, <Item: four>]
# If we replace the default ordering, Django adjusts the required tables
# automatically. Item normally requires a join with Note to do the default