diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/question.html | 8 | ||||
-rw-r--r-- | yaksh/views.py | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 8976fed..0c48167 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -90,11 +90,11 @@ function call_skip(url) form.action = url form.submit(); } - {% if question.type == 'code' and success == 'True'%} - {% if to_attempt|length != 0 %} + {% if question.type == 'code' and success == 'True'%} + {% if paper.questions_left %} window.setTimeout(function() { - {% for qid, num in questions.items %} + {% for qid in paper.questions.all %} location.href="{{ URL_ROOT }}/exam/{{ qid.id }}/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" {% endfor %} }, 1000); @@ -120,7 +120,7 @@ function call_skip(url) <li><h5><a> Hi {{ paper.user.first_name.title}} {{ paper.user.last_name.title}} </a></h5></li> </ul><br> <div class=time-div id="time_left"></div> - <h5 class=td1-class>You have {{ paper.questions_left }} question(s) left in {{ paper.question_paper.quiz.description }}</h5> + <h5>You have {{ paper.questions_left }} question(s) left in {{ paper.question_paper.quiz.description }}</h5> </div> </div> </div> diff --git a/yaksh/views.py b/yaksh/views.py index d06785f..314814d 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -689,7 +689,10 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None): else: # Display the same question if user_answer is None if not user_answer: + ci = RequestContext(request) msg = "Please submit a valid option or code" + context = {'question': question, 'error_message': msg, + 'paper': paper} elif question.type == 'code' and user_answer: msg = "Correct Output" success = "True" @@ -698,9 +701,6 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None): 'error_message': msg, 'success': success} ci = RequestContext(request) - context = {'question': question, 'error_message': msg, - 'paper': paper} - ci = RequestContext(request) return my_render_to_response('yaksh/question.html', context, context_instance=ci) else: |