[EMAIL PROTECTED] wrote:
> Please take a look at this:
> 
> from django.core import meta
> from django.models.core import sites
> 
> class Group(meta.Model):
>       site = meta.ForeignKey(sites.Site)
> 
> class Product(meta.Model):
>       group = meta.ForeignKey(Group)
>       class META:
>               admin = meta.Admin(list_display=('group', 'site'))
> 
> Of course I am unable to put 'site' into list_display because its not a
> foreign key in Product. Adding a foreign key for sites.Site to Product
> seems very redundant. Is there a way to get a product-group-site
> listing for this cascaded foreign key?
> 
> An option would be support for methods in list_display (if implemented)
> 
> 

Have you tried,

  class Product(meta.Model):
        group = meta.ForeignKey(Group)
        class META:
                admin = meta.Admin(list_display=('group', 'get_site'))

        def get_site(self):
            return self.get_group().get_site()

?

Methods are meant to work in the list_display.

Reply via email to