mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-12-25 08:18:48 +01:00
19 lines
456 B
Python
19 lines
456 B
Python
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]+$"
|
|
message = _(
|
|
"Enter a valid username. This value may contain only "
|
|
"English letters and numbers"
|
|
)
|
|
flags = re.ASCII
|
|
|
|
|
|
custom_username_validators = [ASCIIUsernameValidator()]
|