mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-27 11:19:21 -04:00
Add postcode validation check for one-off letters
We’re doing this everywhere else now, so this completes the story. It uses the same regex as elsewhere and the error messaging is consistent (but not uniform) with the other places.
This commit is contained in:
@@ -769,6 +769,11 @@ class LetterAddressForm(StripWhitespaceForm):
|
||||
f'Address must be no more than {PostalAddress.MAX_LINES} lines long'
|
||||
)
|
||||
|
||||
if not address.postcode:
|
||||
raise ValidationError(
|
||||
f'Last line of the address must be a real UK postcode'
|
||||
)
|
||||
|
||||
|
||||
class EmailTemplateForm(BaseTemplateForm):
|
||||
subject = TextAreaField(
|
||||
|
||||
Reference in New Issue
Block a user