Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordering models in Django admin - the light / right way

I want to order models in my Django admin interface. The default is alphabetical ordering of models within apps.

I would like to avoid creating extra packages etc, etc, or having to alter Django itself.

Can this be done by overriding Django admin templates, or some other, lightweight way?

EDIT:

I dont want to order final items, like a list of todos.

I want to order different models in index page of admin. E.g. todos come before cars.

like image 597
tonino.j Avatar asked Dec 23 '12 05:12

tonino.j


1 Answers

You can override the template and add a templatetag to sort. Here's a snippet, it might need some alteration http://djangosnippets.org/snippets/1939/

like image 191
Hedde van der Heide Avatar answered Sep 26 '22 06:09

Hedde van der Heide