diff options
author | ankitjavalkar | 2016-06-03 11:59:11 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-06-03 11:59:11 +0530 |
commit | 42a77fcf968c532dc1cb61fab9f45a9903067e61 (patch) | |
tree | f3136bdfa3cf69bbcc69fb8d88eb542bddff16bb /yaksh/views.py | |
parent | 660a8b4f8b21a1e5836536a9db755fcf840ecd63 (diff) | |
download | online_test-42a77fcf968c532dc1cb61fab9f45a9903067e61.tar.gz online_test-42a77fcf968c532dc1cb61fab9f45a9903067e61.tar.bz2 online_test-42a77fcf968c532dc1cb61fab9f45a9903067e61.zip |
Add codemirror
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 2a3adbf..32b4545 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -383,11 +383,18 @@ def show_question(request, question, paper, error_message=None): reason='Your time is up!' return complete(request, reason, paper.attempt_number, paper.question_paper.id) test_cases = question.get_test_cases() - context = {'question': question, 'paper': paper, 'error_message': error_message, - 'test_cases': test_cases} + context = {'question': question, + 'paper': paper, + 'error_message': error_message, + 'test_cases': test_cases, + 'last_attempt': question.snippet.encode('unicode-escape') + } + answers = paper.get_previous_answers(question) if answers: - context['last_attempt'] = answers[0] + last_attempt = "{}\n{}".format(question.snippet, answers[0].answer) + context['last_attempt'] = last_attempt.encode('unicode-escape') + # context['last_attempt'] = answers[0].answer.encode('unicode-escape') ci = RequestContext(request) return my_render_to_response('yaksh/question.html', context, context_instance=ci) |