Работа с Enum полями
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user