From c10115b4e5f38a8d204910101f1cf632108eaf34 Mon Sep 17 00:00:00 2001 From: Tom Walker Date: Wed, 11 Jun 2014 22:27:05 +0100 Subject: [PATCH] will need to overhaul views to allow easier integration of new question types --- quiz/views.py | 4 ++++ templates/quiz/question.html | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/quiz/views.py b/quiz/views.py index f61c19d..fed4282 100644 --- a/quiz/views.py +++ b/quiz/views.py @@ -187,10 +187,12 @@ def load_anon_next_question(request, quiz): next_question_id = question_list[0] question = Question.objects.get(id=next_question_id) + question_type = next_question.__class__.__name__ return render_to_response('question.html', {'quiz': quiz, 'question': question, + 'question_type': question_type, 'previous': previous, 'show_advert': show_advert, }, @@ -232,10 +234,12 @@ def user_load_next_question(request, sitting, quiz): next_question = Question.objects.get(id=question_ID) + question_type = next_question.__class__.__name__ return render_to_response('question.html', {'quiz': quiz, 'question': next_question, + 'question_type': question_type, 'previous': previous, 'show_advert': show_advert, }, diff --git a/templates/quiz/question.html b/templates/quiz/question.html index 85baa53..ea07a32 100644 --- a/templates/quiz/question.html +++ b/templates/quiz/question.html @@ -11,10 +11,10 @@ {% if previous %} - -

The previous question:

+ +

The previous question:

{{ previous.previous_question }}

- + {% ifequal previous.previous_outcome 'correct' %}
{% else %} @@ -23,17 +23,19 @@

Your answer was {{ previous.previous_answer }} which is {{ previous.previous_outcome }}

- + {% correct_answer previous %}

Explanation:

{{ previous.previous_question.explanation }}

- - + +
- -{% endif %}
+ +{% endif %} + +
{% if question %} @@ -41,11 +43,11 @@

Question category: {{ question.category }}

{{ question.content }}

{% answers_for_question question quiz %} - + {% endif %} - +
- + -- 2.39.5