Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Question(models.Model):
- question_text = models.CharField(max_length=400)
- def __unicode__(self): # __unicode__ on Python 2
- return self.question_text
- class Mytest(models.Model):
- mytest_name = models.CharField(max_length=400)
- pub_date = models.DateTimeField('Дата:')
- question = models.ManyToManyField(Question, verbose_name="Вопросы")
- def __unicode__(self): # __unicode__ on Python 2
- return self.mytest_name
- class Choice(models.Model):
- choice_text = models.CharField(max_length=400)
- question = models.ForeignKey(Question)
- ANSWER_CHOICES = (
- ('1', 'Правильный ответ'),
- ('0', 'Неправильный ответ'),
- )
- answer = models.CharField(max_length=1, choices=ANSWER_CHOICES, default=0)
- def __unicode__(self): # __unicode__ on Python 2
- return self.choice_text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement