mirror of https://github.com/sgoudham/Enso-Bot.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
687 B
Python
26 lines
687 B
Python
5 years ago
|
import re
|
||
|
|
||
|
from django.core import validators
|
||
|
from django.utils.deconstruct import deconstructible
|
||
|
from django.utils.translation import gettext_lazy as _
|
||
|
|
||
|
|
||
|
@deconstructible
|
||
|
class ASCIIUsernameValidator(validators.RegexValidator):
|
||
|
regex = r'^[\w.@+-]+\Z'
|
||
|
message = _(
|
||
|
'Enter a valid username. This value may contain only English letters, '
|
||
|
'numbers, and @/./+/-/_ characters.'
|
||
|
)
|
||
|
flags = re.ASCII
|
||
|
|
||
|
|
||
|
@deconstructible
|
||
|
class UnicodeUsernameValidator(validators.RegexValidator):
|
||
|
regex = r'^[\w.@+-]+\Z'
|
||
|
message = _(
|
||
|
'Enter a valid username. This value may contain only letters, '
|
||
|
'numbers, and @/./+/-/_ characters.'
|
||
|
)
|
||
|
flags = 0
|