alex/django-filter — pull request #106 by timheap (2013-07-16 07:13:24+00:00)
Title: Add `FilterSet.get_order()` method for very custom ordering

The `order_by` option for `FilterSet`s did not allow ordering on multiple fields. Being able to sort on multiple fields is useful for sorting people by name, where the conventional orderings are (`last_name`, `first_name`) and (`first_name`, `last_name`).

I've added a method `get_order` which allows customising the ordering of a `QuerySet` beyond what is currently possible. This method should return an iterable of values which will be passed to `QuerySet.order_by()`. By default, this just returns a single element list of the chosen ordering parameter.

I chose to add this method instead, as adding yet another way for the `order_by` option was getting confusing. That option already functions in three different ways, adding a fourth did not seem a sane option to me. This also allows even more complicated sorting to happen, which could potentially depend upon the data submitted in the request or other such things.

See the updated docs and test case for a working example.