Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
On Sun, Sep 6, 2009 at 10:46 PM, Karen Tracey wrote: > On Sun, Sep 6, 2009 at 6:21 AM, Joshua Partogi > wrote: > >> >> On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: >> >>> Define a custom method on the FooAdmin class which returns the HTML of >>> a link to the Bar changelist with the rel

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Karen Tracey
On Sun, Sep 6, 2009 at 6:21 AM, Joshua Partogi wrote: > > On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: > >> Define a custom method on the FooAdmin class which returns the HTML of >> a link to the Bar changelist with the relevant filter applied: >> >>def bar_link(self, obj): >>

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: > > On Sep 6, 8:39 am, Joshua Partogi wrote: > > Dear all, > > > > I have a model that has a foreign e.g > > > > class Foo(models.Model): > > bar = models.ForeignKey(Bar) > > > > class Bar(models.Model): > > name = models.CharField(max_len

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Daniel Roseman
On Sep 6, 8:39 am, Joshua Partogi wrote: > Dear all, > > I have a model that has a foreign e.g > > class Foo(models.Model): >   bar = models.ForeignKey(Bar) > > class Bar(models.Model): >   name = models.CharField(max_length=50) > > This is my FooAdmin: > class FooAdmin(admin.ModelAdmin): >   lis

Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
Dear all, I have a model that has a foreign e.g class Foo(models.Model): bar = models.ForeignKey(Bar) class Bar(models.Model): name = models.CharField(max_length=50) This is my FooAdmin: class FooAdmin(admin.ModelAdmin): list_display = ['bar'] Now in the admin Foo's display list I want t