summaryrefslogtreecommitdiff
path: root/templates/exam/question.html
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-25 18:48:13 +0530
committerPrabhu Ramachandran2011-11-25 18:48:13 +0530
commitfdc531b561565345847812f409ee44af0a784e82 (patch)
tree447b297d28dccb700dcd244404e6cd748191890d /templates/exam/question.html
parentb4023e17d6f97e51ffde740c17d19630b5a9c2d1 (diff)
downloadonline_test-fdc531b561565345847812f409ee44af0a784e82.tar.gz
online_test-fdc531b561565345847812f409ee44af0a784e82.tar.bz2
online_test-fdc531b561565345847812f409ee44af0a784e82.zip
ENH: Adding support for Multiple Choice Questions
Adds simple support for multiple choice questions that are also auto-checked. Many fixes to the templates and useful feature additions. This changes the database.
Diffstat (limited to 'templates/exam/question.html')
-rw-r--r--templates/exam/question.html17
1 files changed, 11 insertions, 6 deletions
diff --git a/templates/exam/question.html b/templates/exam/question.html
index f4d3f67..62b8b3d 100644
--- a/templates/exam/question.html
+++ b/templates/exam/question.html
@@ -60,15 +60,20 @@ function update_time()
<form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/" method="post">
{% csrf_token %}
-
-<textarea rows="20" cols="100" name="answer">
-{% if last_attempt %}{{last_attempt}}{% else %}# Enter your answer here.{% endif %}
-</textarea>
-
+{% if question.type == "mcq" %}
+{% for option in question.options.strip.splitlines %}
+<input name="answer" type="radio" value="{{option}}" />{{option}} <br/>
+{% endfor %}
+{% else %}
+<textarea rows="20" cols="100" name="answer">{% if last_attempt %}{{last_attempt.strip}}{% else %}# Enter your answer here.{% endif %}</textarea>
+{% endif %}
<br/>
-
+{% if question.type == "mcq" %}
+<input id="check" type="submit" name="check" value="Submit answer"/>
+{% else %}
<input id="check" type="submit" name="check" value="Check Answer"
onclick="submitCode();"/>
+{% endif %}
<input id="skip" type="submit" name="skip" value="Skip question" />
</form>