mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-25 10:29:14 -04:00
Merge pull request #1168 from alphagov/contact-letter-block
add letter_contact_block edit fields
This commit is contained in:
@@ -486,10 +486,23 @@ class ServiceSmsSender(Form):
|
||||
)
|
||||
|
||||
def validate_sms_sender(form, field):
|
||||
if field.data and not re.match('^[a-zA-Z0-9\s]+$', field.data):
|
||||
if field.data and not re.match(r'^[a-zA-Z0-9\s]+$', field.data):
|
||||
raise ValidationError('Use letters and numbers only')
|
||||
|
||||
|
||||
class ServiceLetterContactBlock(Form):
|
||||
letter_contact_block = TextAreaField(
|
||||
'How should users contact you?'
|
||||
)
|
||||
|
||||
def validate_letter_contact_block(form, field):
|
||||
line_count = field.data.strip().count('\n')
|
||||
if line_count >= 10:
|
||||
raise ValidationError(
|
||||
'Contains {} lines, maximum is 10'.format(line_count + 1)
|
||||
)
|
||||
|
||||
|
||||
class ServiceBrandingOrg(Form):
|
||||
|
||||
def __init__(self, organisations=[], *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user