Re: rendering to template help

2010-05-28 Thread Daniel Roseman
On May 27, 3:10 pm, Pirate Pete wrote: > hello again, > > i am trying to get a single entry from my db and then annotate the > count and rating to it like we established above > > however it doesn't seem to be returning anything: > videos = > Video.objects.get(id=vid_id).annotate(rating_count=Coun

Re: rendering to template help

2010-05-27 Thread Pirate Pete
hello again, i am trying to get a single entry from my db and then annotate the count and rating to it like we established above however it doesn't seem to be returning anything: videos = Video.objects.get(id=vid_id).annotate(rating_count=Count('rating'), rating_avg=Avg('rating__rating')) i even

Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 10:30 am, Pirate Pete wrote: > sorry for this one last question, > > do you have any idea how i would go about rounding these values and > converting them from numbers to *'s ? > > i tried using the round() function on the annotation however it kept > giving me a type error "a float is

Re: rendering to template help

2010-05-25 Thread Pirate Pete
sorry for this one last question, do you have any idea how i would go about rounding these values and converting them from numbers to *'s ? i tried using the round() function on the annotation however it kept giving me a type error "a float is required." cheers On May 25, 7:10 pm, Daniel Rosem

Re: rendering to template help

2010-05-25 Thread Pirate Pete
You sir have saved me many a headache, i can't honestly thank you enough All the best! On May 25, 7:10 pm, Daniel Roseman wrote: > On May 25, 9:52 am, Pirate Pete wrote: > > > Thank you very very much for your reply. > > > There is still a few things i need to grasp. > > > Firstly, why did you

Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 9:52 am, Pirate Pete wrote: > Thank you very very much for your reply. > > There is still a few things i need to grasp. > > Firstly, why did you do this : > annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rat > ing')) > as opposed to annotate(rating_count=Count(

Re: rendering to template help

2010-05-25 Thread Pirate Pete
Thank you very very much for your reply. There is still a few things i need to grasp. Firstly, why did you do this : annotate(rating_count=Count('rating')).annotate(rating_avg=Avg('rating__rating')) as opposed to annotate(rating_count=Count('rating'), rating_avg=Avg('rating__rating')) Secondly,

Re: rendering to template help

2010-05-25 Thread Daniel Roseman
On May 25, 6:09 am, Pirate Pete wrote: > I have been trying to get some kind of kind response from django for a > few days now and it has been very unkind to me :P > > basically i need to create a page that has a video title (link) and an > average rating with the amount of people that rated it in

rendering to template help

2010-05-24 Thread Pirate Pete
I have been trying to get some kind of kind response from django for a few days now and it has been very unkind to me :P basically i need to create a page that has a video title (link) and an average rating with the amount of people that rated it in brackets. so it will look like ... Awesom video