From 619576002d538094dde7293d970bc4698ecdbef5 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 11 Mar 2008 05:21:50 +0000 Subject: queyrset-refactor: Added error reporting if somebody tries to order by a multi-valued field. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7220 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/queries/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index ff55550d4e..17476217cd 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -418,6 +418,13 @@ FieldError: Infinite loop caused by ordering. >>> Ranking.objects.all().order_by('rank') [, , ] +# Ordering by a many-valued attribute (e.g. a many-to-many or reverse +# ForeignKey) doesn't make sense (there's no natural ordering). +>>> 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 # ordering, but that isn't needed here. -- cgit v1.3