This commit is contained in:
Ross
2021-09-13 08:48:37 +01:00
parent 4e876f76b8
commit bc91259ae4
3 changed files with 28 additions and 1 deletions
+5
View File
@@ -34,6 +34,8 @@ from longs.models import Long as LongQuestion
from longs.models import Exam as LongExam
from anatomy.models import AnatomyQuestion as AnatomyQuestion
from anatomy.models import Exam as AnatomyExam
from sbas.models import Question as SbasQuestion
from sbas.models import Exam as SbasExam
from django.db.models import Case, When
from django.conf import settings
@@ -53,6 +55,9 @@ def get_question_and_content_type(question_type):
elif question_type == "long":
question = LongQuestion
content_type = ContentType.objects.get(model="long")
elif question_type == "sba":
question = SbasQuestion
content_type = ContentType.objects.get(model="sba")
else:
raise PermissionError()
@@ -0,0 +1,18 @@
# Generated by Django 3.2.6 on 2021-09-13 07:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0051_exam_double_mark'),
]
operations = [
migrations.AlterField(
model_name='exam',
name='double_mark',
field=models.BooleanField(default=True, help_text='Defines if an exam is expected to be double marked'),
),
]
+5 -1
View File
@@ -11,10 +11,12 @@ from django.utils.translation import ugettext_lazy as _
from sortedm2m.fields import SortedManyToManyField
from generic.models import ExamBase
from generic.models import ExamBase, QuestionNote
import reversion
from django.contrib.contenttypes.fields import GenericRelation
class Category(models.Model):
category = models.CharField(max_length=200)
@@ -99,6 +101,8 @@ class Question(models.Model):
Category, on_delete=models.SET_NULL, null=True, blank=True
)
notes = GenericRelation(QuestionNote)
def __str__(self):
return self.stem