Re: Django Admin - list_display doesn't follow FK links?

2011-01-29 Thread Mathieu Möller
Hey Victor, - I changed my subscription to my gmail-account because I'm not sure if my email went trough. Here is it again. - I do the following to get data out of a related table/model: Of course you could access your other model via __unicode__...

Re: Django Admin - list_display doesn't follow FK links?

2011-01-29 Thread Excite User
Hey Victor, I do the following to get data out of a related table/model: Of course you could access your other model via __unicode__... Or, simply write a function for your model and use a callback in your list_display: Here an easy "quick and dirty" example: class othermodel(models.Model)

Re: Django Admin - list_display doesn't follow FK links?

2011-01-29 Thread Daniel Roseman
On Saturday, January 29, 2011 12:28:49 PM UTC, Victor Hooi wrote: > > Hi, > > I'm trying to use list_display in the django-admin, and I can't seem to > find a way to get list_display to follow FK links. > > My models.py: > > class Site(models.Model): > name = models.CharField(max_length=50,

Django Admin - list_display doesn't follow FK links?

2011-01-29 Thread Victor Hooi
Hi, I'm trying to use list_display in the django-admin, and I can't seem to find a way to get list_display to follow FK links. My models.py: class Site(models.Model): name = models.CharField(max_length=50, unique=True) description = models.TextField() def __unicode__(self):

Re: Missing template variable when using django admin list_display

2010-08-30 Thread Karen Tracey
On Mon, Aug 30, 2010 at 4:13 PM, christian.oudard < christian.oud...@gmail.com> wrote: > On Django 1.2, I'm getting a missing template variable when using a > custom formatter in the django admin. > > Here is my admin class: > > class CustomerAdmin(admin.ModelAdmin): >fields = [ >

Missing template variable when using django admin list_display

2010-08-30 Thread christian.oudard
On Django 1.2, I'm getting a missing template variable when using a custom formatter in the django admin. Here is my admin class: class CustomerAdmin(admin.ModelAdmin): fields = [ 'name', ] list_display = [ 'name', 'customer_tenants', ] def

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-18 Thread Alex Robbins
There is also an online version of one of the django books here: http://djangobook.com/ On Jan 17, 5:08 pm, pfwd wrote: > Thanks fantastic thank you > I was also able to do: > result = obj.task_set.aggregate(Count('id'))['id__count'] > to get the a count of the tasks for

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-18 Thread nostradamnit
I recommend this book - and the answer to your question is in chapter 8. http://www.amazon.com/Practical-Django-Projects-Pratical/dp/1590599969 go ahead and get this one too http://www.amazon.com/Python-Essential-Reference-David-Beazley/dp/0672329786/ref=pd_sim_b_4 and read

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread pfwd
Thanks fantastic thank you I was also able to do: result = obj.task_set.aggregate(Count('id'))['id__count'] to get the a count of the tasks for quote I don't suppose you know any good books regarding Python/Django that I could buy to help me learn the syntax better? Many thanks On Jan 17, 10:15 

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread Daniel Roseman
On Jan 17, 8:28 pm, pfwd wrote: > Hi am very new to Django/Python and I need some help with a model > method > > I have two tables Linked by a foreign key and their forms are embedded > in the admin interface. > One table is called Quote and one table is called Task. The

Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread pfwd
Hi am very new to Django/Python and I need some help with a model method I have two tables Linked by a foreign key and their forms are embedded in the admin interface. One table is called Quote and one table is called Task. The task table has a field called time_taken In the Quote list I want to

Re: admin list_display

2009-09-27 Thread paulhide
wrote: > On Sep 26, 12:53 pm, paulh <paul.h...@gmail.com> wrote: > > > > > Using the admin list_display and a callable with its allow_tags > > property set to True you can plant a link for each object on the > > changle_list display page of the admin. Is ther

Re: admin list_display

2009-09-27 Thread Daniel Roseman
On Sep 26, 12:53 pm, paulh <paul.h...@gmail.com> wrote: > Using the admin list_display and a callable with its allow_tags > property set to True you can plant a link for each object on the > changle_list display page of the admin. Is there some way of making > this link dyna

Re: admin list_display

2009-09-27 Thread paulhide
to these callables, or maybe I am looking in the wrong place. Paul Hide On Sep 26, 12:53 pm, paulh <paul.h...@gmail.com> wrote: > Using the admin list_display and a callable with its allow_tags > property set to True you can plant a link for each object on the > changle_list display pa

admin list_display

2009-09-26 Thread paulh
Using the admin list_display and a callable with its allow_tags property set to True you can plant a link for each object on the changle_list display page of the admin. Is there some way of making this link dynamic without having to extend the ModelAdmin.changelist_view and its associated

Re: ManyToManyField in Admin list_display

2008-07-02 Thread urukay
blank = True, > null = True) > city = models.CharField(max_length = 4, choices = > SLOVAK_DISTRICT_CHOICES, db_index = True) > > def __str__(self): > return '%s:' '%s' %(self.region, self.city) > > class Admin

ManyToManyField in Admin list_display

2008-07-02 Thread urukay
, choices = SLOVAK_DISTRICT_CHOICES, db_index = True) def __str__(self): return '%s:' '%s' %(self.region, self.city) class Admin: list_display = ('region', 'city') class JobOffer(ATag): created = models.DateTimeField