From 54d3479b4abe28b7780f2fee3e7cb456773105d5 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 14 Oct 2016 17:16:44 +0200 Subject: [PATCH] no Nones in exam form --- wtem/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wtem/views.py b/wtem/views.py index 504fa5b..0696174 100644 --- a/wtem/views.py +++ b/wtem/views.py @@ -54,11 +54,11 @@ def form_during(request, key): else: answers = {} for exercise in exercises_with_answers: - exercise['saved_answer'] = answers.get(str(exercise['id']), {}) + exercise['saved_answer'] = answers.get(str(exercise['id']), '') if exercise['type'] == 'open' and exercise.get('fields'): field_answers = {field['id']: field['text'] for field in exercise['saved_answer']} for field in exercise['fields']: - field['saved_answer'] = field_answers.get(field['id']) + field['saved_answer'] = field_answers.get(field['id'], '') if request.method == 'GET': return render(request, 'wtem/main.html', {'exercises': exercises_with_answers, 'end_time': submission.end_time}) elif request.method == 'POST': -- 2.20.1