summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorankitjavalkar2019-01-11 15:13:48 +0530
committerankitjavalkar2019-01-11 15:13:48 +0530
commit7bcc57d6624696baaf314698b66c78ff3e5d11df (patch)
tree2a95c288f1506d451790abbc8632a1d8fce3bb61 /yaksh
parent75c5ed2569715610dd0d4864659501d101eb640d (diff)
downloadonline_test-7bcc57d6624696baaf314698b66c78ff3e5d11df.tar.gz
online_test-7bcc57d6624696baaf314698b66c78ff3e5d11df.tar.bz2
online_test-7bcc57d6624696baaf314698b66c78ff3e5d11df.zip
Ensure that the Answers displayed in grade_user.html, user_data.html and view_answerpaper escape special characters
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/templates/yaksh/grade_user.html26
-rw-r--r--yaksh/templates/yaksh/user_data.html26
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html24
3 files changed, 38 insertions, 38 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 2a22bd9..a76f2c7 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -164,27 +164,27 @@ Status : <b style="color: red;"> Failed </b><br/>
{% for testcase in question.get_test_cases %}
{% if testcase.correct %}
<br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
<span class="alert alert-success"> Correct </span>
{% else %}
<br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {{ forloop.counter }}. {{ testcase.options }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
<h5> <u>Correct Answer:</u></h5>
{% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
+ <strong>{{ testcase.correct }}</strong>
{% if testcase.error_margin %}
- <strong>{{ testcase.error_margin|safe }}</strong>
+ <strong>{{ testcase.error_margin }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "arrange" %}
<h5> <u>Correct Order:</u></h5>
<div class="list-group" >
{% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
{% endfor %}
</div>
@@ -303,7 +303,7 @@ Status : <b style="color: red;"> Failed </b><br/>
</div>
</div> <!-- Closes card -->
{% else %}
- <pre><code> {{error|safe}} </code></pre>
+ <pre><code> {{error}} </code></pre>
{% endif %}
{% endfor %}
{% endwith %}
@@ -311,13 +311,13 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card-body">
{% if question.type == "code" %}
- <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
+ <pre><code>{{ ans.answer.answer.strip }}</code></pre>
{% elif question.type == "mcc"%}
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" in ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -326,8 +326,8 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" == ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -338,7 +338,7 @@ Status : <b style="color: red;"> Failed </b><br/>
<div class="card-body">
{% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
</div>
</div>
@@ -346,7 +346,7 @@ Status : <b style="color: red;"> Failed </b><br/>
{% else %}
<div class="card">
<div class="card-body">
- {{ ans.answer.answer.strip|safe }}
+ {{ ans.answer.answer.strip }}
</div>
</div>
{% endif %}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index d424e54..62e9c56 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -67,25 +67,25 @@ User IP address: {{ paper.user_ip }}
{% for testcase in question.get_test_cases %}
{% if testcase.correct %}
<br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
<span class="label label-success"> Correct </span>
{% else %}
<br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {{ forloop.counter }}. {{ testcase.options }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
<h5> <u>Correct Answer:</u></h5>
{% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
+ <strong>{{ testcase.correct }}</strong>
{% endfor %}
{% elif question.type == "arrange" %}
<h5> <u>Correct Order:</u></h5>
<div class="list-group" >
{% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
{% endfor %}
</div>
@@ -111,8 +111,8 @@ User IP address: {{ paper.user_ip }}
{% if question.type == "mcc"%}
<div class="well well-sm">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" in answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -120,8 +120,8 @@ User IP address: {{ paper.user_ip }}
{% elif question.type == "mcq"%}
<div class="well well-sm">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" == answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -130,13 +130,13 @@ User IP address: {{ paper.user_ip }}
<div class="well well-sm">
{% get_answer_for_arrange_options answers.0.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
</div>
{%else%}
<div class="well well-sm">
- {{ answers.0.answer|safe }}
+ {{ answers.0.answer }}
</div>
{% endif %}
</div>
@@ -220,7 +220,7 @@ User IP address: {{ paper.user_ip }}
</table>
</div> <!-- Closes well -->
{% else %}
- <pre><code> {{error|safe}} </code></pre>
+ <pre><code> {{error}} </code></pre>
{% endif %}
{% endfor %}
{% endwith %}
@@ -231,10 +231,10 @@ User IP address: {{ paper.user_ip }}
{% if question.type != "code" %}
<div class="well well-sg">
{{question.type}}
- {{ answer.answer.answer.strip|safe }}
+ {{ answer.answer.answer.strip }}
</div>
{% else %}
- <pre><code>{{ answer.answer.answer.strip|safe }}</code></pre>
+ <pre><code>{{ answer.answer.answer.strip }}</code></pre>
{% endif %}
</div>
</div>
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index 2246db1..b87c818 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -54,32 +54,32 @@
</strong>
</div>
<div class="card-body">
- <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong>
+ <h5><u>Question:</u></h5> <strong>{{ question.description }}</strong>
{% if question.type == "mcq" or question.type == "mcc" %}
<h5> <u>Choices:</u></h5>
{% get_ordered_testcases question paper as testcases %}
{% for testcase in testcases %}
{% if testcase.correct %}
<br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
<span class="alert alert-success"> Correct</span>
{% else %}
<br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
+ {{ forloop.counter }}. {{ testcase.options }}</strong>
{% endif %}
{% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
<h5> <u>Correct Answer:</u></h5>
{% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
+ <strong>{{ testcase.correct }}</strong>
{% endfor %}
{% elif question.type == "arrange" %}
<h5> <u>Correct Order:</u></h5>
<div class="list-group">
{% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
+ <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
{% endfor %}
</div>
@@ -106,8 +106,8 @@
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" in answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -116,8 +116,8 @@
<div class="card">
<div class="card-body">
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == answers.0.answer|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
+ {%if testcases.id|stringformat:"i" == answers.0.answer %}
+ <li>{{ testcases.options.strip }}</li>
{% endif %}
{% endfor %}
</div>
@@ -127,7 +127,7 @@
<div class="card-body">
{% get_answer_for_arrange_options answers.0.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
</div>
</div>
@@ -142,7 +142,7 @@
<h5><u>Student answer:</u></h5>
<div class="card">
<div class="card-body">
- {{ answers.0.answer|safe }}
+ {{ answers.0.answer }}
</div>
</div>
{% endif %}
@@ -236,7 +236,7 @@
</table>
</div> <!-- Closes well -->
{% else %}
- <pre><code> {{error|safe}} </code></pre>
+ <pre><code> {{error}} </code></pre>
{% endif %}
{% endfor %}
{% endwith %}