Change TO form to accept decimals for CLIN input fields
This commit is contained in:
parent
526ab59024
commit
f6a04aea62
@ -1,6 +1,6 @@
|
|||||||
from wtforms.fields import (
|
from wtforms.fields import (
|
||||||
BooleanField,
|
BooleanField,
|
||||||
IntegerField,
|
DecimalField,
|
||||||
RadioField,
|
RadioField,
|
||||||
SelectField,
|
SelectField,
|
||||||
SelectMultipleField,
|
SelectMultipleField,
|
||||||
@ -10,7 +10,7 @@ from wtforms.fields import (
|
|||||||
)
|
)
|
||||||
from wtforms.fields.html5 import DateField, TelField
|
from wtforms.fields.html5 import DateField, TelField
|
||||||
from wtforms.widgets import ListWidget, CheckboxInput
|
from wtforms.widgets import ListWidget, CheckboxInput
|
||||||
from wtforms.validators import Length
|
from wtforms.validators import Length, InputRequired
|
||||||
from flask_wtf.file import FileAllowed
|
from flask_wtf.file import FileAllowed
|
||||||
|
|
||||||
from atst.forms.validators import IsNumber, PhoneNumber, RequiredIf
|
from atst.forms.validators import IsNumber, PhoneNumber, RequiredIf
|
||||||
@ -97,20 +97,44 @@ class FundingForm(CacheableForm):
|
|||||||
],
|
],
|
||||||
render_kw={"accept": ".pdf,.png,application/pdf,image/png"},
|
render_kw={"accept": ".pdf,.png,application/pdf,image/png"},
|
||||||
)
|
)
|
||||||
clin_01 = IntegerField(translate("forms.task_order.clin_01_label"))
|
clin_01 = DecimalField(
|
||||||
clin_02 = IntegerField(translate("forms.task_order.clin_02_label"))
|
translate("forms.task_order.clin_01_label"),
|
||||||
clin_03 = IntegerField(translate("forms.task_order.clin_03_label"))
|
places=2,
|
||||||
clin_04 = IntegerField(translate("forms.task_order.clin_04_label"))
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
clin_02 = DecimalField(
|
||||||
|
translate("forms.task_order.clin_02_label"),
|
||||||
|
places=2,
|
||||||
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
clin_03 = DecimalField(
|
||||||
|
translate("forms.task_order.clin_03_label"),
|
||||||
|
places=2,
|
||||||
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
clin_04 = DecimalField(
|
||||||
|
translate("forms.task_order.clin_04_label"),
|
||||||
|
places=2,
|
||||||
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class UnclassifiedFundingForm(FundingForm):
|
class UnclassifiedFundingForm(FundingForm):
|
||||||
clin_02 = IntegerField(translate("forms.task_order.unclassified_clin_02_label"))
|
clin_02 = DecimalField(
|
||||||
clin_04 = IntegerField(translate("forms.task_order.unclassified_clin_04_label"))
|
translate("forms.task_order.unclassified_clin_02_label"),
|
||||||
|
places=2,
|
||||||
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
clin_04 = DecimalField(
|
||||||
|
translate("forms.task_order.unclassified_clin_04_label"),
|
||||||
|
places=2,
|
||||||
|
validators=[InputRequired(message="Please enter a dollar amount")],
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.clin_02.data = "0"
|
self.clin_02.data = "0.00"
|
||||||
self.clin_04.data = "0"
|
self.clin_04.data = "0.00"
|
||||||
|
|
||||||
|
|
||||||
class OversightForm(CacheableForm):
|
class OversightForm(CacheableForm):
|
||||||
|
@ -119,7 +119,7 @@ def test_task_order_form_shows_errors(client, user_session):
|
|||||||
|
|
||||||
body = response.data.decode()
|
body = response.data.decode()
|
||||||
assert "There were some errors" in body
|
assert "There were some errors" in body
|
||||||
assert "Not a valid integer" in body
|
assert "Not a valid decimal" in body
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user