You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
400 B

7 years ago
from django.core import validators
from django.utils import six
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
7 years ago
import re
7 years ago
@deconstructible
class HandleValidator(validators.RegexValidator):
regex = r'^[A-Z]+[0-9]+(-[A-Z]+)'
message = _(
'Enter a valid handle (all uppercase)'
)
flags = re.ASCII if six.PY3 else 0