Optimize phone validator
This commit is contained in:
		| @@ -159,25 +159,11 @@ class SiteAccountManager(BaseUserManager): | |||||||
|  |  | ||||||
|  |  | ||||||
| class SiteUser(AbstractBaseUser, PermissionsMixin): | class SiteUser(AbstractBaseUser, PermissionsMixin): | ||||||
|     """ |  | ||||||
|     Here we are subclassing the Django AbstractBaseUser, which comes with only |  | ||||||
|     3 fields: |  | ||||||
|     1 - password |  | ||||||
|     2 - last_login |  | ||||||
|     3 - is_active |  | ||||||
|     Note than all fields would be required unless specified otherwise, with |  | ||||||
|     `required=False` in the parentheses. |  | ||||||
|     The PermissionsMixin is a model that helps you implement permission settings |  | ||||||
|     as-is or modified to your requirements. |  | ||||||
|     More info: https://goo.gl/YNL2ax |  | ||||||
|     """ |  | ||||||
|     surname = models.CharField(max_length=60, verbose_name="Фамилия") |     surname = models.CharField(max_length=60, verbose_name="Фамилия") | ||||||
|     name = models.CharField(max_length=60, verbose_name="Имя") |     name = models.CharField(max_length=60, verbose_name="Имя") | ||||||
|     email = models.EmailField(unique=True, verbose_name="Email") |     email = models.EmailField(unique=True, verbose_name="Email") | ||||||
|     phone = models.CharField(unique=True, max_length=16, verbose_name="Телефон", validators=[ |     phone = models.CharField(unique=True, max_length=16, verbose_name="Телефон", validators=[ | ||||||
|         RegexValidator(regex="^\\+7[0-9]*$"), |         RegexValidator(regex="^\\+7[0-9]{10}$"), | ||||||
|         MaxLengthValidator(limit_value=12), |  | ||||||
|         MinLengthValidator(limit_value=12) |  | ||||||
|     ]) |     ]) | ||||||
|     is_staff = models.BooleanField(default=False, verbose_name="Разрешение на вход в админку") |     is_staff = models.BooleanField(default=False, verbose_name="Разрешение на вход в админку") | ||||||
|     is_phone_verified = models.BooleanField(default=False, verbose_name="Телефон верифицирован") |     is_phone_verified = models.BooleanField(default=False, verbose_name="Телефон верифицирован") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user