release notes for Django 1.4 say that Django now supports Multiple sort in admin interface :
Changelog admin now supports multi-column sorting. This respects all elements of the ordering attribute and sorts by several columns by clicking on the headers, designed to simulate the behavior of graphical desktop interfaces.
And from Order ModelAdmin :
Set ordering to specify how object lists should be ordered in Django Admin Views. It must be a list or tuple in the same format as an ordering model parameter. [...] Django rewards all items in a list / tuple; to 1.4, only the first was respected.
In a semi-dependent note - if you override queryset to provide a custom sort order, it seems that Changelist override this sort order. It applies any sort found in the ordering parameter, and if it is not there, it applies the default sort on pk , thereby negating any sort that you did in queryset .
I think it should work - at least this Django Ticket is fixed. But I was just trying to apply a custom view using queryset few days ago, and this did not work for me. Even single-field sorting seemed to be redefined in the final representation. So I did something wrong, or that's not all that was fixed. :)
Note that you can do custom sorting by code, but you must subclass the Changelist and override its get_query_set() method, according to this snippet . (Although this is too much if you only need to sort multiple fields, as Django 1.4 now supports multiple fields).
source share