From: Richard Mansfield Date: Sun, 10 Aug 2014 23:15:46 +0000 (+1200) Subject: Display user answers on the results page X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8d3fbe8a1b81f4dbacc1f2149c25d8e654c082b1;p=django_quiz.git Display user answers on the results page --- 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