Add in default values and filters to the TO Forms
This commit is contained in:
parent
ed20c6a6a2
commit
1b642e22f6
@ -31,6 +31,13 @@ class AppInfoWithExistingPortfolioForm(BaseForm):
|
||||
scope = TextAreaField(
|
||||
translate("forms.task_order.scope_label"),
|
||||
description=translate("forms.task_order.scope_description"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
defense_component = SelectField(
|
||||
translate("forms.task_order.defense_component_label"),
|
||||
choices=SERVICE_BRANCHES,
|
||||
default="",
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
app_migration = RadioField(
|
||||
translate("forms.task_order.app_migration.label"),
|
||||
@ -50,20 +57,30 @@ class AppInfoWithExistingPortfolioForm(BaseForm):
|
||||
translate("forms.task_order.complexity.label"),
|
||||
description=translate("forms.task_order.complexity.description"),
|
||||
choices=APPLICATION_COMPLEXITY,
|
||||
default="",
|
||||
default=None,
|
||||
filters=[lambda x: x or None],
|
||||
widget=ListWidget(prefix_label=False),
|
||||
option_widget=CheckboxInput(),
|
||||
)
|
||||
complexity_other = StringField(translate("forms.task_order.complexity_other_label"))
|
||||
complexity_other = StringField(
|
||||
translate("forms.task_order.complexity_other_label"),
|
||||
default=None,
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
dev_team = SelectMultipleField(
|
||||
translate("forms.task_order.dev_team.label"),
|
||||
description=translate("forms.task_order.dev_team.description"),
|
||||
choices=DEV_TEAM,
|
||||
default="",
|
||||
default=None,
|
||||
filters=[lambda x: x or None],
|
||||
widget=ListWidget(prefix_label=False),
|
||||
option_widget=CheckboxInput(),
|
||||
)
|
||||
dev_team_other = StringField(translate("forms.task_order.dev_team_other_label"))
|
||||
dev_team_other = StringField(
|
||||
translate("forms.task_order.dev_team_other_label"),
|
||||
default=None,
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
team_experience = RadioField(
|
||||
translate("forms.task_order.team_experience.label"),
|
||||
description=translate("forms.task_order.team_experience.description"),
|
||||
@ -139,19 +156,26 @@ class UnclassifiedFundingForm(FundingForm):
|
||||
|
||||
class OversightForm(BaseForm):
|
||||
ko_first_name = StringField(
|
||||
translate("forms.task_order.oversight_first_name_label")
|
||||
translate("forms.task_order.oversight_first_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
ko_last_name = StringField(
|
||||
translate("forms.task_order.oversight_last_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
ko_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
|
||||
ko_email = StringField(
|
||||
translate("forms.task_order.oversight_email_label"),
|
||||
validators=[Optional(), Email()],
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
ko_phone_number = TelField(
|
||||
translate("forms.task_order.oversight_phone_label"),
|
||||
validators=[Optional(), PhoneNumber()],
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
ko_dod_id = StringField(
|
||||
translate("forms.task_order.oversight_dod_id_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[
|
||||
RequiredIf(lambda form: form._fields.get("ko_invite").data),
|
||||
Length(min=10),
|
||||
@ -161,15 +185,21 @@ class OversightForm(BaseForm):
|
||||
|
||||
am_cor = BooleanField(translate("forms.task_order.oversight_am_cor_label"))
|
||||
cor_first_name = StringField(
|
||||
translate("forms.task_order.oversight_first_name_label")
|
||||
translate("forms.task_order.oversight_first_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
cor_last_name = StringField(
|
||||
translate("forms.task_order.oversight_last_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
cor_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
|
||||
cor_email = StringField(
|
||||
translate("forms.task_order.oversight_email_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[Optional(), Email()],
|
||||
)
|
||||
cor_phone_number = TelField(
|
||||
translate("forms.task_order.oversight_phone_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[
|
||||
RequiredIf(lambda form: not form._fields.get("am_cor").data),
|
||||
Optional(),
|
||||
@ -178,6 +208,7 @@ class OversightForm(BaseForm):
|
||||
)
|
||||
cor_dod_id = StringField(
|
||||
translate("forms.task_order.oversight_dod_id_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[
|
||||
RequiredIf(
|
||||
lambda form: not form._fields.get("am_cor").data
|
||||
@ -189,19 +220,26 @@ class OversightForm(BaseForm):
|
||||
)
|
||||
|
||||
so_first_name = StringField(
|
||||
translate("forms.task_order.oversight_first_name_label")
|
||||
translate("forms.task_order.oversight_first_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
so_last_name = StringField(
|
||||
translate("forms.task_order.oversight_last_name_label"),
|
||||
filters=[lambda x: x or None],
|
||||
)
|
||||
so_last_name = StringField(translate("forms.task_order.oversight_last_name_label"))
|
||||
so_email = StringField(
|
||||
translate("forms.task_order.oversight_email_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[Optional(), Email()],
|
||||
)
|
||||
so_phone_number = TelField(
|
||||
translate("forms.task_order.oversight_phone_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[Optional(), PhoneNumber()],
|
||||
)
|
||||
so_dod_id = StringField(
|
||||
translate("forms.task_order.oversight_dod_id_label"),
|
||||
filters=[lambda x: x or None],
|
||||
validators=[
|
||||
RequiredIf(lambda form: form._fields.get("so_invite").data),
|
||||
Length(min=10),
|
||||
|
@ -190,9 +190,17 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
|
||||
to_data.pop("defense_component")
|
||||
|
||||
# don't save other text in DB unless "other" is checked
|
||||
if "complexity" in to_data and "other" not in to_data["complexity"]:
|
||||
if (
|
||||
"complexity" in to_data
|
||||
and bool(to_data["complexity"])
|
||||
and "other" not in to_data["complexity"]
|
||||
):
|
||||
to_data["complexity_other"] = None
|
||||
if "dev_team" in to_data and "other" not in to_data["dev_team"]:
|
||||
if (
|
||||
"dev_team" in to_data
|
||||
and bool(to_data["dev_team"])
|
||||
and "other" not in to_data["dev_team"]
|
||||
):
|
||||
to_data["dev_team_other"] = None
|
||||
|
||||
if self.form_data.get("am_cor"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user