-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
23 lines (19 loc) · 797 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.db import models
from django.utils.translation import gettext_lazy as _
class Question(models.Model):
question_text = models.CharField(max_length=200, verbose_name=_("Question name"))
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
class Meta:
verbose_name = _("Question")
verbose_name_plural = _("Question")
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200, verbose_name=_("Choice name"))
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
class Meta:
verbose_name = _("Choice")
verbose_name_plural = _("Choice")