diff --git a/generic/views.py b/generic/views.py index 825a0297..fa490abb 100644 --- a/generic/views.py +++ b/generic/views.py @@ -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() diff --git a/longs/migrations/0052_alter_exam_double_mark.py b/longs/migrations/0052_alter_exam_double_mark.py new file mode 100644 index 00000000..af4fbf12 --- /dev/null +++ b/longs/migrations/0052_alter_exam_double_mark.py @@ -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'), + ), + ] diff --git a/sbas/models.py b/sbas/models.py index f5c8308e..58755a54 100644 --- a/sbas/models.py +++ b/sbas/models.py @@ -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