mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-01 04:09:46 -04:00
Add GovukIntegerField - extends IntegerField
This commit is contained in:
@@ -325,6 +325,19 @@ class GovukDateField(DateField):
|
||||
return govuk_field_widget(self, field, param_extensions=param_extensions, **kwargs)
|
||||
|
||||
|
||||
class GovukIntegerField(IntegerField):
|
||||
def __init__(self, label='', validators=None, param_extensions=None, **kwargs):
|
||||
super(GovukIntegerField, self).__init__(label, validators, **kwargs)
|
||||
self.param_extensions = param_extensions
|
||||
|
||||
# self.__call__ renders the HTML for the field by:
|
||||
# 1. delegating to self.meta.render_field which
|
||||
# 2. calls field.widget
|
||||
# this bypasses that by making self.widget a method with the same interface as widget.__call__
|
||||
def widget(self, field, param_extensions=None, **kwargs):
|
||||
return govuk_field_widget(self, field, param_extensions=param_extensions, **kwargs)
|
||||
|
||||
|
||||
class SMSCode(GovukTextInputField):
|
||||
validators = [
|
||||
DataRequired(message='Cannot be empty'),
|
||||
|
||||
Reference in New Issue
Block a user