.
This commit is contained in:
+3
-2
@@ -369,14 +369,15 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
return JsonResponse(exam_json)
|
return JsonResponse(exam_json)
|
||||||
|
|
||||||
def exam_question_json(self, request, pk, sk):
|
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)
|
exam = get_object_or_404(self.Exam, pk=pk)
|
||||||
|
|
||||||
if not exam.active:
|
if not question.active:
|
||||||
raise Http404("No available exam")
|
raise Http404("No available exam")
|
||||||
|
|
||||||
question_json_cache = cache.get("{}_question_json_{}".format(self.app_name, sk))
|
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
|
question_json_cache["cached"] = True
|
||||||
return JsonResponse(question_json_cache)
|
return JsonResponse(question_json_cache)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user