Python, Django, Django Rest Framework, Backend, Programming.
django.contrib.auth.models import AbstractUser from django.core.validators import RegexValidator class User(AbstractUser): phone = models.CharField(max_length=10,unique=True, blank=True, null=True, validators=[RegexValidator( regex=r"^\d{10}", message="Phone number must be 10 digits only.")])