SOITA/questions/models.py
Hubert Jankowski 71cd22bbbb add tournaments
2022-05-24 21:01:45 +02:00

27 lines
682 B
Python

from django.db import models
from .managers import QuestionManager
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.CharField(max_length=200)
points = models.PositiveSmallIntegerField(default=1)
def get_answers_secret(self):
return [
answer.get_secret_answer()
for answer in self.answers.all()
]
tournament = models.ManyToManyField(
"trials.Tournament",
null=True
)
objects = QuestionManager()