Applied the delete method of the Account data model to the delete_account view, to make things easier.

This commit is contained in:
依瑪貓 2023-02-07 00:22:23 +08:00
parent 570c84c196
commit d78b941674

View File

@ -159,9 +159,7 @@ def delete_account(account: Account) -> redirect:
:return: The redirection to the account list on success, or the account :return: The redirection to the account list on success, or the account
detail on error. detail on error.
""" """
for l10n in account.l10n: account.delete()
db.session.delete(l10n)
db.session.delete(account)
sort_accounts_in(account.base_code, account.id) sort_accounts_in(account.base_code, account.id)
db.session.commit() db.session.commit()
flash(lazy_gettext("The account is deleted successfully."), "success") flash(lazy_gettext("The account is deleted successfully."), "success")