Hello,
here is  my model

class Mark(meta.Model):
recipe = meta.ForeignKey(Recipe)
user = meta.ForeignKey(User, unique=True)
mark = meta.SmallIntegerField()

        def __repr__(self):
                return "%s" % (self.get_recipe(), self.get_user(), mark)


i want a user to be alble to mark a recipe only once, or if not once,
update the previous entry he had for this recipe.

I ll have to get the average mark by selecting all rows where recipe id
= x , adding mark and divising by count.

how would you do that ?


--~--~---------~--~----~------------~-------~--~----~
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