mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 12:58:31 -04:00
Allow free allowance to be set to 0
We want to be able to set the free allowance for a service to 0, but the form was not allowing this - it gave an error message of `Cannot be empty`. This can be fixed by changing the WTForms validator from `DataRequired` (which coerces 0 to falsey) to the `InputRequired` validator.
This commit is contained in:
@@ -40,7 +40,14 @@ from wtforms import (
|
||||
ValidationError,
|
||||
validators,
|
||||
)
|
||||
from wtforms.validators import URL, DataRequired, Length, Optional, Regexp
|
||||
from wtforms.validators import (
|
||||
URL,
|
||||
DataRequired,
|
||||
InputRequired,
|
||||
Length,
|
||||
Optional,
|
||||
Regexp,
|
||||
)
|
||||
|
||||
from app.formatters import format_thousands, guess_name_from_email_address
|
||||
from app.main.validators import (
|
||||
@@ -1300,7 +1307,7 @@ class FreeSMSAllowance(StripWhitespaceForm):
|
||||
free_sms_allowance = GovukIntegerField(
|
||||
'Numbers of text message fragments per year',
|
||||
validators=[
|
||||
DataRequired(message='Cannot be empty')
|
||||
InputRequired(message='Cannot be empty')
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user