SOITA/questions/models.py

27 lines
682 B
Python
Raw Normal View History

2021-12-05 13:50:34 +01:00
from django.db import models
2021-12-12 11:35:35 +01:00
from .managers import QuestionManager
2021-12-05 13:50:34 +01:00
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="")
2021-12-12 23:34:54 +01:00
description = models.CharField(max_length=200)
2021-12-05 13:50:34 +01:00
points = models.PositiveSmallIntegerField(default=1)
def get_answers_secret(self):
return [
answer.get_secret_answer()
for answer in self.answers.all()
]
2021-12-12 11:35:35 +01:00
2022-05-24 21:01:45 +02:00
tournament = models.ManyToManyField(
"trials.Tournament",
null=True
)
2021-12-12 11:35:35 +01:00
objects = QuestionManager()