Re: Using a ForeignKey in ordering

2007-04-04 Thread Aidas Bendoraitis
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

Re: Using a ForeignKey in ordering

2007-04-04 Thread Aidas Bendoraitis
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 coul

Re: Using a ForeignKey in ordering

2007-04-04 Thread James Turnbull
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 object

Re: Using a ForeignKey in ordering

2007-04-04 Thread Atilla
On 04/04/07, James Turnbull <[EMAIL PROTECTED]> wrote: > > I'm trying to group items in the Admin interface based on a foreign > key, and I'm hitting a few stumbling blocks. > > Simplified objects are... > > > class MenuItem(models.Model): > > name = models.CharField(maxlength=200) > > > > cla

Using a ForeignKey in ordering

2007-04-04 Thread James Turnbull
I'm trying to group items in the Admin interface based on a foreign key, and I'm hitting a few stumbling blocks. Simplified objects are... > class MenuItem(models.Model): > name = models.CharField(maxlength=200) > > class Page(models.Model): > name = models.CharField(maxlength=200) >