Add order creation form

This commit is contained in:
2022-09-27 16:57:05 +03:00
parent 7b19ac39c1
commit 659de0b0ee
6 changed files with 79 additions and 41 deletions

View File

@@ -156,17 +156,7 @@ class SiteAccountManager(BaseUserManager):
return user
def get_by_natural_key(self, phone_):
# Гоша попросил запилить фичу, чтобы принимались номера:
# +79991112233
# 79991112233
# 9991112233
if re.match("^[0-9]{10}$", phone_) is not None:
phone_ = f"+7{phone_}"
elif re.match("^7[0-9]{10}$", phone_) is not None:
phone_ = f"+{phone_}"
return self.get(phone=phone_)
return self.model.get_by_natural_key(phone_)
class SiteUser(AbstractBaseUser, PermissionsMixin):