I am building a simple application which has questions. Each question will have a binary vote (yes/no). I want to record the vote per user, so each user only gets one vote per question (similar to stack overflow or reddit).

I have a votes\_no and votes\_yes int field on the question. These need to be updated in a transaction every time a vote is added. Can I do this from the Vote model's save method?

```
class Question(models.Model):
    part_isit = models.CharField(max_length=45)
    part_if = models.CharField(max_length=90)
    votes_no = models.IntegerField()
    votes_yes = models.IntegerField()
    author = models.ForeignKey(User)
    create_date = models.DateField(auto_now_add=True)

VOTE_CHOICES = (
    ('Y', 'Yes'),
    ('N', 'No'),
)

class Vote(models.Model):
    choice = models.CharField(max_length=1, choices=VOTE_CHOICES)
    question = models.ForeignKey(Question)
    author = models.ForeignKey(User)
    create_date = models.DateField(auto_now_add=True)
    def save(self):
       # increment the questions vote totals

       #save the vote
       super(Vote, self).save();

```