From 7bcc57d6624696baaf314698b66c78ff3e5d11df Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Fri, 11 Jan 2019 15:13:48 +0530 Subject: Ensure that the Answers displayed in grade_user.html, user_data.html and view_answerpaper escape special characters --- yaksh/templates/yaksh/grade_user.html | 26 +++++++++++++------------- yaksh/templates/yaksh/user_data.html | 26 +++++++++++++------------- yaksh/templates/yaksh/view_answerpaper.html | 24 ++++++++++++------------ 3 files changed, 38 insertions(+), 38 deletions(-) (limited to 'yaksh') 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 : Failed
{% for testcase in question.get_test_cases %} {% if testcase.correct %}
- {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} Correct {% else %}
- {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} {% endif %} {% endfor %} {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
Correct Answer:
{% for testcase in question.get_test_cases %} - {{ testcase.correct|safe }} + {{ testcase.correct }} {% if testcase.error_margin %} - {{ testcase.error_margin|safe }} + {{ testcase.error_margin }} {% endif %} {% endfor %} {% elif question.type == "arrange" %}
Correct Order:
{% for testcase in question.get_test_cases %} -
  • {{ testcase.options|safe }}
  • +
  • {{ testcase.options }}
  • {% endfor %}
    @@ -303,7 +303,7 @@ Status : Failed
    {% else %} -
     {{error|safe}} 
    +
     {{error}} 
    {% endif %} {% endfor %} {% endwith %} @@ -311,13 +311,13 @@ Status : Failed
    {% if question.type == "code" %} -
    {{ ans.answer.answer.strip|safe }}
    +
    {{ ans.answer.answer.strip }}
    {% elif question.type == "mcc"%}
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" in ans.answer.answer.strip %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -326,8 +326,8 @@ Status : Failed
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" == ans.answer.answer.strip %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -338,7 +338,7 @@ Status : Failed
    {% get_answer_for_arrange_options ans.answer.answer question as tc_list %} {% for testcases in tc_list %} -
  • {{ testcases.options.strip|safe }}
  • +
  • {{ testcases.options.strip }}
  • {% endfor %}
    @@ -346,7 +346,7 @@ Status : Failed
    {% else %}
    - {{ ans.answer.answer.strip|safe }} + {{ ans.answer.answer.strip }}
    {% 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 %}
    - {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} Correct {% else %}
    - {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} {% endif %} {% endfor %} {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
    Correct Answer:
    {% for testcase in question.get_test_cases %} - {{ testcase.correct|safe }} + {{ testcase.correct }} {% endfor %} {% elif question.type == "arrange" %}
    Correct Order:
    {% for testcase in question.get_test_cases %} -
  • {{ testcase.options|safe }}
  • +
  • {{ testcase.options }}
  • {% endfor %}
    @@ -111,8 +111,8 @@ User IP address: {{ paper.user_ip }} {% if question.type == "mcc"%}
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" in answers.0.answer|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" in answers.0.answer %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -120,8 +120,8 @@ User IP address: {{ paper.user_ip }} {% elif question.type == "mcq"%}
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" == answers.0.answer|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" == answers.0.answer %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -130,13 +130,13 @@ User IP address: {{ paper.user_ip }}
    {% get_answer_for_arrange_options answers.0.answer question as tc_list %} {% for testcases in tc_list %} -
  • {{ testcases.options.strip|safe }}
  • +
  • {{ testcases.options.strip }}
  • {% endfor %}
    {%else%}
    - {{ answers.0.answer|safe }} + {{ answers.0.answer }}
    {% endif %}
    @@ -220,7 +220,7 @@ User IP address: {{ paper.user_ip }}
    {% else %} -
     {{error|safe}} 
    +
     {{error}} 
    {% endif %} {% endfor %} {% endwith %} @@ -231,10 +231,10 @@ User IP address: {{ paper.user_ip }} {% if question.type != "code" %}
    {{question.type}} - {{ answer.answer.answer.strip|safe }} + {{ answer.answer.answer.strip }}
    {% else %} -
    {{ answer.answer.answer.strip|safe }}
    +
    {{ answer.answer.answer.strip }}
    {% endif %} 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 @@
    -
    Question:
    {{ question.description|safe }} +
    Question:
    {{ question.description }} {% if question.type == "mcq" or question.type == "mcc" %}
    Choices:
    {% get_ordered_testcases question paper as testcases %} {% for testcase in testcases %} {% if testcase.correct %}
    - {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} Correct {% else %}
    - {{ forloop.counter }}. {{ testcase.options|safe }} + {{ forloop.counter }}. {{ testcase.options }} {% endif %} {% endfor %} {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
    Correct Answer:
    {% for testcase in question.get_test_cases %} - {{ testcase.correct|safe }} + {{ testcase.correct }} {% endfor %} {% elif question.type == "arrange" %}
    Correct Order:
    {% for testcase in question.get_test_cases %} -
  • {{ testcase.options|safe }}
  • +
  • {{ testcase.options }}
  • {% endfor %}
    @@ -106,8 +106,8 @@
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" in answers.0.answer|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" in answers.0.answer %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -116,8 +116,8 @@
    {% for testcases in question.get_test_cases %} - {%if testcases.id|stringformat:"i" == answers.0.answer|safe %} -
  • {{ testcases.options.strip|safe }}
  • + {%if testcases.id|stringformat:"i" == answers.0.answer %} +
  • {{ testcases.options.strip }}
  • {% endif %} {% endfor %}
    @@ -127,7 +127,7 @@
    {% get_answer_for_arrange_options answers.0.answer question as tc_list %} {% for testcases in tc_list %} -
  • {{ testcases.options.strip|safe }}
  • +
  • {{ testcases.options.strip }}
  • {% endfor %}
    @@ -142,7 +142,7 @@
    Student answer:
    - {{ answers.0.answer|safe }} + {{ answers.0.answer }}
    {% endif %} @@ -236,7 +236,7 @@
    {% else %} -
     {{error|safe}} 
    +
     {{error}} 
    {% endif %} {% endfor %} {% endwith %} -- cgit