Mercurial > public > sg101
comparison polls/models.py @ 1206:02181fa5ac9d modernize tip
Update to Django 1.9.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 22 Jan 2025 17:58:16 -0600 |
parents | eeaf387803c6 |
children |
comparison
equal
deleted
inserted
replaced
1205:510ef3cbf3e6 | 1206:02181fa5ac9d |
---|---|
87 return self.is_open() | 87 return self.is_open() |
88 | 88 |
89 | 89 |
90 class Choice(models.Model): | 90 class Choice(models.Model): |
91 """Model for poll choices""" | 91 """Model for poll choices""" |
92 poll = models.ForeignKey(Poll) | 92 poll = models.ForeignKey(Poll, on_delete=models.CASCADE) |
93 choice = models.CharField(max_length=200) | 93 choice = models.CharField(max_length=200) |
94 votes = models.IntegerField(default=0) | 94 votes = models.IntegerField(default=0) |
95 voters = models.ManyToManyField(User, blank=True) | 95 voters = models.ManyToManyField(User, blank=True) |
96 | 96 |
97 def __unicode__(self): | 97 def __unicode__(self): |