correcting myself: a) Page.objects.order_by('menuitem__name') --> Page.objects.select_related().order_by('menu_menuitem.name')
Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > As far as I know, currently it's impossible to sort items according > the fields of the related model in the contributed administration. > > If that's your business requirement, then you have the following > hacking options: > a) write a custom view which will override the default admin list > where you could Page.objects.order_by('menuitem__name') > b) duplicate menuitem.name as a field in the page page.menuitem_name, > make it editable=False and add post_save signal to the menuitem which > will populate its name value to the hidden field of the page. Then > sort by that field. > c) create some template tag which reorders items according some > conditions and override the change_list.html template for the page > model. > > Regards, > Aidas Bendoraitis [aka Archatas] > > > > On 4/4/07, James Turnbull <[EMAIL PROTECTED]> wrote: > > > > Thanks Atilla, > > > > > There was a simmilar question a couple of days ago: > > > > > class Meta: > > > ordering = ['name'] > > > > I did read this thread but it appears to only be useful for sorting > > the MenuItem objects when viewed through a drop down or some such. > > What I want to do is sort the Page objects, but based on their > > relation to the MenuItem objects. > > > > James > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---