Is there a way to calculate and store the average rating in this
example:

RATING_CHOICES = {
 '3' : 'Excellent',
 '2' : 'Good',
 '1' : 'Poor',
}

class Loan(....
 ...
 book = models.ForeignKey(Book)
 rating = models.IntegerField(choices=RATING_CHOICES)
 ...

class BookRatings(...
 ...
 book = models.ForeignKey(Book)
 rating = models.IntegerField(...here I would like the average rating
from the Loan model...)
 nums = models.IntegerField(...and here the number of ratings
done...)
 ...
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to