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 d

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 task table > has a field c

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-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 http://diveintopython.

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 quote > > I don't suppose