summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-07-05 10:02:24 -0400
committerGitHub2016-07-05 10:02:24 -0400
commit0245ad5d20820fdf0cdcdec7f5d4e153289e7e3d (patch)
tree8f356d28a49e7687c1f71eeacc53fd62415d3c5b /yaksh/views.py
parent15152d232ab81a1ec6af24b10424d85f1c01d170 (diff)
parent1b83aa2da97212cb839086ef5c91a6f9e68a3a36 (diff)
downloadonline_test-0245ad5d20820fdf0cdcdec7f5d4e153289e7e3d.tar.gz
online_test-0245ad5d20820fdf0cdcdec7f5d4e153289e7e3d.tar.bz2
online_test-0245ad5d20820fdf0cdcdec7f5d4e153289e7e3d.zip
Merge pull request #107 from ankitjavalkar/codemirror
Add CodeMirror to Code questions
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 02b2487..e2ff84f 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -412,11 +412,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 = 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)