Merge pull request #1168 from alphagov/contact-letter-block

add letter_contact_block edit fields
This commit is contained in:
Chris Hill-Scott
2017-03-06 11:11:54 +00:00
committed by GitHub
13 changed files with 208 additions and 13 deletions

View File

@@ -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):