Switch to ExmBase
This commit is contained in:
+4
-30
@@ -13,7 +13,7 @@ from sortedm2m.fields import SortedManyToManyField
|
||||
|
||||
import string
|
||||
|
||||
from generic.models import Examination
|
||||
from generic.models import Examination, ExamBase
|
||||
|
||||
image_storage = FileSystemStorage(
|
||||
# Physical file location ROOT
|
||||
@@ -263,42 +263,16 @@ class Answer(models.Model):
|
||||
# self.answer.strip()
|
||||
|
||||
|
||||
class Exam(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
class Exam(ExamBase):
|
||||
app_name = "anatomy"
|
||||
|
||||
exam_questions = SortedManyToManyField(
|
||||
AnatomyQuestion, related_name="exams", blank="true"
|
||||
)
|
||||
|
||||
active = models.BooleanField(
|
||||
help_text="If an exam should be available", default=True
|
||||
)
|
||||
|
||||
publish_results = models.BooleanField(
|
||||
help_text="If an exams results should be available", default=True
|
||||
)
|
||||
|
||||
recreate_json = models.BooleanField(
|
||||
help_text="If the json cache needs updating", default=False
|
||||
)
|
||||
|
||||
time_limit = models.IntegerField(
|
||||
help_text="Exam time limit (in seconds)", default=5400
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("anatomy:exam_overview", kwargs={"pk": self.pk})
|
||||
|
||||
def get_exam_name(self):
|
||||
return self.name
|
||||
|
||||
def get_json_url(self):
|
||||
return reverse("anatomy:exam_json", args=(self.pk,))
|
||||
|
||||
def get_question_index(self, question):
|
||||
return list(self.exam_questions.all()).index(question)
|
||||
|
||||
|
||||
# class UserAnswer(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user