Sort drop-down list in Admin module

686 views
Skip to first unread message

Bobo

unread,
Nov 12, 2008, 9:30:32 AM11/12/08
to Django users
Hi everyone,

In my admin module I've some drop-down lists that extract data from my
database but the thing is that it sort the list from the Database ID
and not alphabetically, starting with A and continuing.

I've search the Django API and Admin docs for a solutions but it seem
that I only find something about a fieldsets (http://
docs.djangoproject.com/en/dev/ref/contrib/admin/) and list_filter and
List_display.

Am I on the right track here or is there a easy method to change the
sorting filter in the admin module of Django???

Regards
Bobo

Daniel Roseman

unread,
Nov 12, 2008, 9:47:51 AM11/12/08
to Django users
Use the ordering attribute of the model's inner Meta class.
See http://docs.djangoproject.com/en/dev/ref/models/options/#ordering

--
DR.
Reply all
Reply to author
Forward
0 new messages