This commit is contained in:
Ross
2021-02-27 11:41:03 +00:00
parent f53d77a17c
commit b7788f5cd2
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -380,7 +380,7 @@ class ExamViews(View, LoginRequiredMixin):
exam_json_cache["cached"] = True
return JsonResponse(exam_json_cache)
exam_json = exam.get_exam_question_json()
exam_json = exam.get_exam_question_json(sk)
cache.set("{}_exam_json_{}_{}".format(self.app_name, pk, sk), exam_json, 3600)
+3 -2
View File
@@ -1,6 +1,7 @@
from django.db.models.fields.files import ImageField
from django.db.models.fields.related import ForeignKey
from django.db import models
from django.shortcuts import get_object_or_404
from django.utils import timezone
import tagulous
import tagulous.models
@@ -417,8 +418,8 @@ class Exam(ExamBase):
default=4500,
)
def get_exam_question_json(self, n):
q = self.exam_questions.all()[n]
def get_exam_question_json(self, question_id):
q = get_object_or_404(Long, pk=question_id)
#exam_order.append(q.id)