mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-02 17:48:50 -04:00
Update ForgivingIntegerField
Makes it inherit from GovukTextInputField. Changes to govuk_field_widget to allow the value attribute to be set by passing a value keyword argument to the __call__ method. Includes changes to templates that use this form and associated tests.
This commit is contained in:
@@ -212,6 +212,8 @@ def password(label='Password'):
|
||||
|
||||
|
||||
def govuk_field_widget(self, field, type=None, param_extensions=None, **kwargs):
|
||||
value = kwargs["value"] if kwargs.get("value") else field.data
|
||||
|
||||
# error messages
|
||||
error_message = None
|
||||
if field.errors:
|
||||
@@ -232,7 +234,7 @@ def govuk_field_widget(self, field, type=None, param_extensions=None, **kwargs):
|
||||
"id": field.id,
|
||||
"label": {"text": field.label.text},
|
||||
"name": field.name,
|
||||
"value": field.data
|
||||
"value": value
|
||||
}
|
||||
|
||||
if type:
|
||||
@@ -331,7 +333,7 @@ class SMSCode(GovukTextInputField):
|
||||
self.data = Columns.make_key(valuelist[0])
|
||||
|
||||
|
||||
class ForgivingIntegerField(StringField):
|
||||
class ForgivingIntegerField(GovukTextInputField):
|
||||
|
||||
# Actual value is 2147483647 but this is a scary looking arbitrary number
|
||||
POSTGRES_MAX_INT = 2000000000
|
||||
|
||||
Reference in New Issue
Block a user