diff options
author | maheshgudi | 2017-09-19 18:53:32 +0530 |
---|---|---|
committer | maheshgudi | 2017-09-19 18:53:32 +0530 |
commit | d8ef3fe1f52fae93dfaa27591661b7871dd0a179 (patch) | |
tree | 597c58bb0083fd1c3be72a1dbc083d7dd1144a8e /yaksh/views.py | |
parent | 4d5cdce5f6e1bb15c773daabfff0e4c841cc6a26 (diff) | |
download | online_test-d8ef3fe1f52fae93dfaa27591661b7871dd0a179.tar.gz online_test-d8ef3fe1f52fae93dfaa27591661b7871dd0a179.tar.bz2 online_test-d8ef3fe1f52fae93dfaa27591661b7871dd0a179.zip |
Fixes Nonetype object has attribute 'encode' error
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 3f9f622..e6da2fc 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -488,7 +488,8 @@ def show_question(request, question, paper, error_message=None, notification=Non answers = paper.get_previous_answers(question) if answers: last_attempt = answers[0].answer - context['last_attempt'] = last_attempt.encode('unicode-escape') + if last_attempt: + context['last_attempt'] = last_attempt.encode('unicode-escape') ci = RequestContext(request) return my_render_to_response('yaksh/question.html', context, context_instance=ci) |