Merge pull request #940 from dod-ccpo/display-clin-type
Fix CLIN type display
This commit is contained in:
commit
c0da5d482f
@ -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"),
|
||||
|
@ -8,7 +8,7 @@ from .application_invitation import ApplicationInvitation
|
||||
from .application_role import ApplicationRole, Status as ApplicationRoleStatus
|
||||
from .attachment import Attachment
|
||||
from .audit_event import AuditEvent
|
||||
from .clin import CLIN
|
||||
from .clin import CLIN, JEDICLINType
|
||||
from .environment import Environment
|
||||
from .environment_role import EnvironmentRole, CSPRole
|
||||
from .notification_recipient import NotificationRecipient
|
||||
|
@ -14,7 +14,7 @@ def render_task_orders_edit(portfolio_id=None, task_order_id=None, form=None):
|
||||
if task_order_id:
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
portfolio_id = task_order.portfolio_id
|
||||
render_args["form"] = form or TaskOrderForm(**task_order.to_dictionary())
|
||||
render_args["form"] = form or TaskOrderForm(obj=task_order)
|
||||
render_args["task_order_id"] = task_order_id
|
||||
render_args["task_order"] = task_order
|
||||
else:
|
||||
|
@ -169,7 +169,7 @@
|
||||
<hr v-if="clinIndex !== 0">
|
||||
<clin-fields
|
||||
v-bind:initial-clin-index='clinIndex'
|
||||
v-bind:initial-clin-type="'JEDICLINType.JEDI_CLIN_1'"
|
||||
v-bind:initial-clin-type="'JEDI_CLIN_1'"
|
||||
inline-template>
|
||||
<div>
|
||||
<div class="form-row">
|
||||
|
11
tests/forms/test_task_order.py
Normal file
11
tests/forms/test_task_order.py
Normal file
@ -0,0 +1,11 @@
|
||||
from atst.forms.task_order import CLINForm
|
||||
from atst.models import JEDICLINType
|
||||
|
||||
import tests.factories as factories
|
||||
|
||||
|
||||
def test_clin_form_jedi_clin_type():
|
||||
jedi_type = JEDICLINType.JEDI_CLIN_2
|
||||
clin = factories.CLINFactory.create(jedi_clin_type=jedi_type)
|
||||
clin_form = CLINForm(obj=clin)
|
||||
assert clin_form.jedi_clin_type.data == jedi_type.value
|
Loading…
x
Reference in New Issue
Block a user