summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-18 10:21:50 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-18 10:21:50 +0000
commit670be13986b74f252d479ee2b7f74da8655273f6 (patch)
tree61a2a676086e0b5a2261961879cc1d09e9678949 /tests
parent8b52e8e40e100f02f09138947fee706c00c3ccbc (diff)
queryset-refactor: Undo [7220] and allow ordering on multi-valued field.
Some people will shoot themselves in the foot with this. That's bad luck. The reason we need it is because some data semantics cannot be expressed in Django's ORM and that shouldn't prevent ordering on that data. For example, filtering suburbs by a geographic region and then ordering on the suburb names. The names might not be unique outside that region, but unique inside it. Django cannot know that (you can't tell the model about it), so we trust the caller. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index a9783569a7..a9517628b4 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -424,11 +424,10 @@ FieldError: Infinite loop caused by ordering.
[<Ranking: 1: a3>, <Ranking: 2: a2>, <Ranking: 3: a1>]
# Ordering by a many-valued attribute (e.g. a many-to-many or reverse
-# ForeignKey) doesn't make sense (there's no natural ordering).
+# 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')
-Traceback (most recent call last):
-...
-FieldError: Cannot order by many-valued field: 'tags'
+[...]
# If we replace the default ordering, Django adjusts the required tables
# automatically. Item normally requires a join with Note to do the default