From e53e00397cdbb953e2349c7e786769e3f0c2c2c4 Mon Sep 17 00:00:00 2001 From: Montana Date: Thu, 10 Jan 2019 11:00:42 -0500 Subject: [PATCH] Only save other text to DB if other is checked --- atst/routes/task_orders/new.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index 4e777e41..5cc7a5a3 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -62,6 +62,21 @@ class ShowTaskOrderWorkflow: return self._task_order + @property + def task_order_formdata(self): + task_order_dict = self.task_order.to_dictionary() + for field in task_order_dict: + if task_order_dict[field] is None: + task_order_dict[field] = "" + + # don't save other text in DB unless "other" is checked + if 'other' not in task_order_dict['complexity']: + task_order_dict['complexity_other'] = "" + if 'other' not in task_order_dict['dev_team']: + task_order_dict['dev_team_other'] = "" + + return task_order_dict + @property def form(self): form_type = (