From 39055b63725adc149ce600257e1aa9559114b15b Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 25 Jan 2021 14:22:48 +0000 Subject: [PATCH] . --- rapids/views.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/rapids/views.py b/rapids/views.py index c97c8bcc..a75820cb 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -1003,4 +1003,37 @@ def exam_scores_cid_user(request, pk, sk): "max_score": max_score, "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, + }, ) \ No newline at end of file