wallet/apps/users/validators.py
2020-11-18 12:03:03 +03:30

12 lines
356 B
Python

from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible
class PhoneNumberValidator(validators.RegexValidator):
regex = r'^\+98\d{10,10}$'
message = _(
"Phone number must be entered in the format: '+989999999999'."
)
flags = 0