9 lines
346 B
Python
9 lines
346 B
Python
from django.core.validators import RegexValidator
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
class SaudiPhoneNumberValidator(RegexValidator):
|
|
def __init__(self):
|
|
super().__init__(
|
|
regex=r'^(\+9665|05)[0-9]{8}$',
|
|
message=_("Enter a valid Saudi phone number (05XXXXXXXX or +9665XXXXXXXX)")
|
|
) |