Работа с Enum полями

This commit is contained in:
2026-07-30 20:12:39 +03:00
parent abd999d245
commit 50f6638416
26 changed files with 601 additions and 38 deletions

View File

@@ -23,6 +23,7 @@ class AccountManager:
Проверяет возможность авторизации Аккаунта
:param account: Аккаунт
:return: Причина отказа в авторизации или None, если авторизация возможна
"""
@@ -30,7 +31,7 @@ class AccountManager:
return AuthRejectReason.INVALID_USERNAME_OR_PASSWORD
if not account.is_active:
return AuthRejectReason.ACCOUNT_IS_NOT_ACTIVE
if account.joined_at is None:
if not account.joined_at:
return AuthRejectReason.REGISTRATION_IS_NOT_COMPLETE
return None
@@ -56,7 +57,7 @@ class AccountManager:
:return: Аккаунт или None, если Аккаунт не найден
"""
return AccountModel.objects.filter(username=username).first()
return AccountModel.objects.filter(username=username).select_related("workspace").first()
@classmethod
def restore_account(cls, account: AccountModel) -> None: