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 --- docs/db-api.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs') diff --git a/docs/db-api.txt b/docs/db-api.txt index 74adc10457..3cab6574ea 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -541,6 +541,13 @@ primary key if there is no ``Meta.ordering`` specified. For example:: ...since the ``Blog`` model has no default ordering specified. +You can only order by model fields that have a single value attached to them +for each instance of the model. For example, non-relations, ``ForeignKey`` and +``OneToOneField`` fields. Explicitly, you can't order by a ``ManyToManyField`` +or a reverse ``ForeignKey`` relation. There's no naturally correct ordering +for many-valued fields and a lot of the alternatives are not psosible to +express in SQL very efficiently. + **New in Django development version:** If you don't want any ordering to be applied to a query, not even the default ordering, call ``order_by()`` with no parameters. -- cgit v1.3