Fixes a bug where the CLIN type was not displaying correctly for saved
TOs. The enum for the CLIN type needs to be coerced in the form data so that the `jedi_clin_field` data is the value of the enum option. Perviously the `jedi_clin_field` was being populated with a stringified representation of the enum, like `JEDICLINType.JEDI_CLIN_1`.
This commit is contained in:
@@ -18,8 +18,18 @@ from atst.forms.validators import FileLength
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
def coerce_enum(enum_inst):
|
||||
if getattr(enum_inst, "value", None):
|
||||
return enum_inst.value
|
||||
else:
|
||||
return enum_inst
|
||||
|
||||
|
||||
class CLINForm(FlaskForm):
|
||||
jedi_clin_type = SelectField("CLIN type", choices=JEDI_CLIN_TYPES)
|
||||
jedi_clin_type = SelectField(
|
||||
"CLIN type", choices=JEDI_CLIN_TYPES, coerce=coerce_enum
|
||||
)
|
||||
|
||||
number = StringField(label="CLIN", validators=[Required()])
|
||||
start_date = DateField(
|
||||
translate("forms.task_order.start_date_label"),
|
||||
|
Reference in New Issue
Block a user