OLD | NEW |
(Empty) | |
| 1 import re |
| 2 |
| 3 from django.core import validators |
| 4 from django.utils import six |
| 5 from django.utils.deconstruct import deconstructible |
| 6 from django.utils.translation import ugettext_lazy as _ |
| 7 |
| 8 |
| 9 @deconstructible |
| 10 class ASCIIUsernameValidator(validators.RegexValidator): |
| 11 regex = r'^[\w.@+-]+$' |
| 12 message = _( |
| 13 'Enter a valid username. This value may contain only English letters, ' |
| 14 'numbers, and @/./+/-/_ characters.' |
| 15 ) |
| 16 flags = re.ASCII if six.PY3 else 0 |
| 17 |
| 18 |
| 19 @deconstructible |
| 20 class UnicodeUsernameValidator(validators.RegexValidator): |
| 21 regex = r'^[\w.@+-]+$' |
| 22 message = _( |
| 23 'Enter a valid username. This value may contain only letters, ' |
| 24 'numbers, and @/./+/-/_ characters.' |
| 25 ) |
| 26 flags = re.UNICODE if six.PY2 else 0 |
OLD | NEW |