Add $ marker to validation regexes
..else they won't match the whole string.
This commit is contained in:
parent
ac3e676e45
commit
8a162acee3
|
@ -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)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue