From 8d3fbe8a1b81f4dbacc1f2149c25d8e654c082b1 Mon Sep 17 00:00:00 2001 From: Richard Mansfield Date: Mon, 11 Aug 2014 11:15:46 +1200 Subject: [PATCH] Display user answers on the results page --- quiz/templates/result.html | 4 ++++ quiz/views.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/quiz/templates/result.html b/quiz/templates/result.html index 4ed25ff..ea202a4 100644 --- a/quiz/templates/result.html +++ b/quiz/templates/result.html @@ -79,6 +79,10 @@ {% correct_answer_for_all question %} + {% if question.user_answer %} +

Your answer: {{ question|answer_choice_to_string:question.user_answer }}

+ {% endif %} +

Explanation:

{{ question.explanation }}

diff --git a/quiz/views.py b/quiz/views.py index f977d5c..e5f3152 100644 --- a/quiz/views.py +++ b/quiz/views.py @@ -215,7 +215,7 @@ class QuizTake(FormView): self.sitting.mark_quiz_complete() if self.quiz.answers_at_end: - results['questions'] = self.sitting.get_questions() + results['questions'] = self.sitting.get_questions(with_answers=True) results['incorrect_questions'] =\ self.sitting.get_incorrect_questions -- 2.39.5