This commit is contained in:
Ross
2021-01-25 14:22:48 +00:00
parent 504bd293b2
commit 39055b6372
+33
View File
@@ -1004,3 +1004,36 @@ def exam_scores_cid_user(request, pk, sk):
"answers_and_marks": answers_and_marks,
},
)
@login_required
def exam_question_detail(request, pk, sk):
exam = get_object_or_404(Exam, pk=pk)
question = exam.exam_questions.all()[sk]
exam_length = len(exam.exam_questions.all())
pos = exam.get_question_index(question) + 1
print(question.exams.through.sort_value)
previous = -1
if sk > 0:
previous = sk - 1
next = sk + 1
if sk == exam_length - 1:
next = False
return render(
request,
"rapids/question_detail.html",
{
"question": question,
"exam": exam,
"next": next,
"previous": previous,
"exam_length": exam_length,
"pos": pos,
},
)