Looking at the options, I've also experimented with creating a custom
Model method.
The following almost works ( The division at the end returns an error
and I'm new at Python so need to work that out)

   def av_rating(self):
            queryset = self.review_set.all()
            x=0
            y=0
            for rating in queryset:
                x=x+rating.rating
                y=y+1
            return x/y

{{ objects.av_rating }} is the tag that is then put in the template.

Can anybody comment on the disadvantage/advantages of using this type
of custom model method?  Also, if anybody can advise me on how I get
the division to work - that would also be appreciated - Django returns
a Zero Division error.

MerMer


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to