daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest May 16th, 2018 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 %}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top