summaryrefslogtreecommitdiff
path: root/testapp/exam/templates
diff options
context:
space:
mode:
authorprathamesh2015-04-07 16:20:13 +0530
committerprathamesh2015-04-07 16:20:13 +0530
commit8fcc1ab1de747bea09b443ba591a684e3054f65b (patch)
tree375ac3b10f95caa79d19ee3ae9f09518e4b5be67 /testapp/exam/templates
parentbcfaf246852cb90a519aab3d0cea21599fd1fd55 (diff)
parent9b7df35eca1557982155fdcc7993b4a7ba77235b (diff)
downloadonline_test-8fcc1ab1de747bea09b443ba591a684e3054f65b.tar.gz
online_test-8fcc1ab1de747bea09b443ba591a684e3054f65b.tar.bz2
online_test-8fcc1ab1de747bea09b443ba591a684e3054f65b.zip
On skip or navigation, the user answer will be saved.
Added boolean field in Answer model to check whether the answered is skipped or not.
Diffstat (limited to 'testapp/exam/templates')
-rw-r--r--testapp/exam/templates/exam/question.html20
1 files changed, 15 insertions, 5 deletions
diff --git a/testapp/exam/templates/exam/question.html b/testapp/exam/templates/exam/question.html
index 57bfd53..eac6792 100644
--- a/testapp/exam/templates/exam/question.html
+++ b/testapp/exam/templates/exam/question.html
@@ -64,6 +64,13 @@ function validate(){
}
}
+function call_skip(url)
+{
+ form = document.forms["code"]
+ form.action = url
+ form.submit();
+}
+
</script>
{% endblock script %}
@@ -97,17 +104,18 @@ function validate(){
</div>
</div>
</div>
+
<div class = container>
-<div class="sidebar">
+ <div class="sidebar">
<p>Question Navigator </p>
<div class="pagination">
<ul>
{% for qid, num in questions.items %}
{% if qid in to_attempt %}
{% if qid == question.id|slugify %}
- <li class="active"><a href="{{ URL_ROOT }}/exam/{{ qid }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/">{{ num }}</a></li>
+ <li class="active"><a href="#" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li>
{% else %}
- <li><a href="{{ URL_ROOT }}/exam/{{ qid }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/">{{ num }}</a></li>
+ <li><a href="#" onclick="call_skip('{{ URL_ROOT }}/exam/{{ qid }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')">{{ num }}</a></li>
{% endif %}
{% endif %}
{% if qid in submitted %}
@@ -116,7 +124,7 @@ function validate(){
{% endfor %}
</ul>
</div>
-</div>
+ </div>
</div>
<h4><u> {{ question.summary }} </u><font class=pull-right>(Marks : {{ question.points }}) </font></h4><br>
@@ -132,7 +140,9 @@ function validate(){
<p id="status"></p>
<form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" enctype="multipart/form-data">
- {% csrf_token %}
+ {% csrf_token %}
+ <input type=hidden name="question_id" id="question_id" value={{ question.id }}></input>
+
{% if question.type == "mcq" %}
{% for option in question.options.strip.splitlines %}
<input name="answer" type="radio" value="{{option}}" />{{option}} <br/>