Guest User

Untitled

a guest
May 16th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. {% for choice in choices %}
  2. {{choice.choice}} - {{votes[choice.id]}} <br />
  3. {% endfor %}
  4.  
  5. class Choice(models.Model):
  6. text = models.CharField(max_length=200)
  7.  
  8. def calculateVotes(self):
  9. return Vote.objects.filter(choice = self).count()
  10.  
  11. votes = property(calculateVotes)
  12.  
  13. {% for choice in choices %}
  14. {{choice.choice}} - {{choice.votes}} <br />
  15. {% endfor %}
Add Comment
Please, Sign In to add comment