Use formdata and change unfilled fields to '' instead of None

This commit is contained in:
Montana 2019-01-03 10:17:14 -05:00
parent f18f4404f5
commit ae55e1c71d
2 changed files with 10 additions and 2 deletions

View File

@ -54,7 +54,9 @@ class ShowTaskOrderWorkflow:
if self._form:
pass
elif self.task_order:
self._form = self._section["form"](data=self.task_order.to_dictionary())
# None causes issues with formdata, so coerce None to ''
formdata = self.process_none_types(self.task_order.to_dictionary())
self._form = self._section["form"](formdata=formdata)
else:
self._form = self._section["form"]()
@ -75,6 +77,12 @@ class ShowTaskOrderWorkflow:
return screen_info
def process_none_types(task_order_dict):
for field in task_order_dict:
if field is None:
field = ''
return task_order_dict
class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
def __init__(self, form_data, user, screen=1, task_order_id=None):

View File

@ -34,7 +34,7 @@
<hr>
<h3>About Your Team</h3>
{{ OptionsInput(form.dev_team) }}
{{ MultiCheckboxInput(form.dev_team) }}
{{ TextInput(form.dev_team_other) }}
{{ OptionsInput(form.team_experience) }}