Fix regexes

This commit is contained in:
Sebastian Lohff 2019-05-30 22:00:21 +02:00
parent ac3e676e45
commit a5e831ec21
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import ipaddress
@deconstructible
class HandleValidator(validators.RegexValidator):
regex = r'^(?:[A-Z]+[0-9]*(-[A-Z]+)|AUTO)'
regex = r'^(?:[A-Z]+[0-9]*(-[A-Z]+)|AUTO)$'
message = _(
'Enter a valid handle (all uppercase)'
)
@ -26,7 +26,7 @@ class HandleValidatorWithSuffix(validators.RegexValidator):
flags = re.ASCII if six.PY3 else 0
def __init__(self, suffix):
self.regex = r'^(?:[A-Z]+[0-9]*-%s|AUTO)' % re.escape(suffix)
self.regex = r'^(?:[A-Z]+[0-9]*-%s|AUTO)$' % re.escape(suffix)
self.message = _(
'Enter a valid handle with suffix %s (all uppercase), e.g. FOO3-%s' % (suffix, suffix)
)