]> git.parisson.com Git - django_quiz.git/commitdiff
Display user answers on the results page
authorRichard Mansfield <richard@dragonfly.co.nz>
Sun, 10 Aug 2014 23:15:46 +0000 (11:15 +1200)
committerRichard Mansfield <richard@dragonfly.co.nz>
Sun, 10 Aug 2014 23:15:46 +0000 (11:15 +1200)
quiz/templates/result.html
quiz/views.py

index 4ed25ff97e9d3769f3832abbf07b19a0f19b54a1..ea202a47a876f2267cd291d01605102881719060 100644 (file)
 
          {% correct_answer_for_all question %}
 
+      {% if question.user_answer %}
+      <p>Your answer: {{ question|answer_choice_to_string:question.user_answer }}</p>
+      {% endif %}
+
          <p><strong>Explanation:</strong></p>
          <div class="well " style="background-color: #fcf8e3;">
                <p>{{ question.explanation }}</p>
index f977d5ca6fd624cd093422302fb33439989431a5..e5f3152766c58baacb03811831b56f3aa2fe8a1b 100644 (file)
@@ -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