This commit is contained in:
Ross
2021-02-28 16:30:47 +00:00
parent 549abd5305
commit a455a4ab96
+3 -2
View File
@@ -369,14 +369,15 @@ class ExamViews(View, LoginRequiredMixin):
return JsonResponse(exam_json)
def exam_question_json(self, request, pk, sk):
question = get_object_or_404(self.Question, pk=sk)
exam = get_object_or_404(self.Exam, pk=pk)
if not exam.active:
if not question.active:
raise Http404("No available exam")
question_json_cache = cache.get("{}_question_json_{}".format(self.app_name, sk))
if question_json_cache is not None and not exam.recreate_json:
if question_json_cache is not None and not question.recreate_json:
question_json_cache["cached"] = True
return JsonResponse(question_json_cache)