SOITA/questions/models.py

20 lines
503 B
Python
Raw Normal View History

2021-12-05 13:50:34 +01:00
from django.db import models
class Question(models.Model):
test = models.ForeignKey(
"trials.Test",
on_delete=models.SET_NULL,
null=True,
related_name="questions"
)
name = models.CharField(max_length=200, default="")
description = models.TextField()
points = models.PositiveSmallIntegerField(default=1)
def get_answers_secret(self):
return [
answer.get_secret_answer()
for answer in self.answers.all()
]