On Wed, 2008-10-08 at 06:21 -0700, David Christiansen wrote:
> Hello all,
> 
> We are currently working on a project in which we would like to order
> the list of model instances on the admin interface by two separate
> parameters.  So far, the second has been ignored. We've tried the
> following:
> 
> 1. Setting the ordering attribute of the ModelAdmin subclass.  The
> documentation says that this will not work, but it was worth a try.
> 
> 2. Setting the ordering on the model's Meta class.  This worked in
> other contexts, but not the admin interface.
> 
> 3. Overriding the ModelAdmin's queryset method to look like:
> 
> def queryset(self, request):
>     return super(PageAdmin,
> self).queryset(request).order_by('tree_id', 'lft')
> 
> where tree_id and lft are the fields we would like to order by.  We're
> at a loss for what to do.

It's not intended to work, so it seems like everything is behaving
correctly from that respect. The admin intentionally only orders on one
field. The reason being that the UI feedback for ordering on more than
one column is generally going to be confusing (nobody's come up with a
good way to represent it yet).

If you have a look in
django.contrib.admin.views.main.ChangeList.get_ordering() you will see
where the single ordering field requirement is enforced. So you could
somehow override that method to get what you want, I guess.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to