start setting up shorts
This commit is contained in:
@@ -130,6 +130,8 @@ from physics.models import (
|
||||
from physics.models import Exam as PhysicsExam
|
||||
from physics.models import UserAnswer as PhysicsUserAnswer
|
||||
|
||||
from shorts.models import Question as ShortsQuestion, ExamQuestionDetail as ShortsExamQuestionDetail, UserAnswer as ShortsUserAnswer, Exam as ShortsExam
|
||||
|
||||
from django.db.models import Case, When
|
||||
from django.conf import settings
|
||||
|
||||
@@ -179,6 +181,7 @@ def get_user_exams(user, supervisor_view=False):
|
||||
"physics": (PhysicsUserAnswer, PhysicsExam, "physics_exams"),
|
||||
"anatomy": (AnatomyUserAnswer, AnatomyExam, "anatomy_exams"),
|
||||
"rapids": (RapidsUserAnswer, RapidsExam, "rapids_exams"),
|
||||
"shorts": (ShortsUserAnswer, ShortsExam, "shorts_exams"),
|
||||
"longs": (LongsUserAnswer, LongsExam, "longs_exams"),
|
||||
"sbas": (SbasUserAnswer, SbasExam, "sbas_exams"),
|
||||
}
|
||||
@@ -215,6 +218,7 @@ def get_exam_model_from_app_name(app_name: str) -> ExamBase:
|
||||
"physics": PhysicsExam,
|
||||
"anatomy": AnatomyExam,
|
||||
"rapids": RapidsExam,
|
||||
"shorts": ShortsExam,
|
||||
"longs": LongsExam,
|
||||
"sbas": SbasExam,
|
||||
}
|
||||
@@ -247,6 +251,9 @@ def get_question_and_content_type(question_type):
|
||||
if question_type == "rapid":
|
||||
question = RapidQuestion
|
||||
content_type = ContentType.objects.get(model="rapid")
|
||||
elif question_type == "shorts":
|
||||
question = ShortsQuestion
|
||||
content_type = ContentType.objects.get(model="rapid")
|
||||
elif question_type == "anatomy":
|
||||
question = AnatomyQuestion
|
||||
content_type = ContentType.objects.get(model="anatomyquestion")
|
||||
@@ -352,6 +359,9 @@ def generic_exam_json_edit(request):
|
||||
if question_type == "rapids":
|
||||
Exam = RapidsExam
|
||||
Question = RapidQuestion
|
||||
elif question_type == "shorts":
|
||||
Exam = ShortsExam
|
||||
Question = ShortsQuestion
|
||||
elif question_type == "longs":
|
||||
Exam = LongsExam
|
||||
Question = LongQuestion
|
||||
@@ -1437,6 +1447,10 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
question_detail = RapidsExamQuestionDetail.objects.get(
|
||||
rapid=question, exam=exam
|
||||
)
|
||||
case "shorts":
|
||||
question_detail = ShortsExamQuestionDetail.objects.get(
|
||||
question=question, exam=exam
|
||||
)
|
||||
case "longs":
|
||||
question_detail = LongsExamQuestionDetail.objects.get(
|
||||
question=question, exam=exam
|
||||
@@ -2590,6 +2604,7 @@ class GenericViewBase:
|
||||
"longs": "longs_checker",
|
||||
"sbas": "sba_checker",
|
||||
"physics": "physics_checker",
|
||||
"shorts": "shorts_checker",
|
||||
}
|
||||
|
||||
self.checker_group = g[app_name]
|
||||
|
||||
Reference in New Issue
Block a user