Removed the excess "with_type" from the success redirection of the update_transaction view.

This commit is contained in:
依瑪貓 2023-03-08 22:10:21 +08:00
parent ff9ff4bdcf
commit 1f87bc00e8
2 changed files with 4 additions and 4 deletions

View File

@ -158,12 +158,12 @@ def update_transaction(txn: Transaction) -> redirect:
form.populate_obj(txn) form.populate_obj(txn)
if not form.is_modified: if not form.is_modified:
flash(lazy_gettext("The transaction was not modified."), "success") flash(lazy_gettext("The transaction was not modified."), "success")
return redirect(inherit_next(with_type(__get_detail_uri(txn)))) return redirect(inherit_next(__get_detail_uri(txn)))
txn.updated_by_id = get_current_user_pk() txn.updated_by_id = get_current_user_pk()
txn.updated_at = sa.func.now() txn.updated_at = sa.func.now()
db.session.commit() db.session.commit()
flash(lazy_gettext("The transaction is updated successfully."), "success") flash(lazy_gettext("The transaction is updated successfully."), "success")
return redirect(inherit_next(with_type(__get_detail_uri(txn)))) return redirect(inherit_next(__get_detail_uri(txn)))
@bp.post("/<transaction:txn>/delete", endpoint="delete") @bp.post("/<transaction:txn>/delete", endpoint="delete")

View File

@ -1741,7 +1741,7 @@ class TransferTransactionTestCase(unittest.TestCase):
""" """
from accounting.models import Transaction, TransactionCurrency from accounting.models import Transaction, TransactionCurrency
txn_id: int = add_txn(self.client, self.__get_add_form()) txn_id: int = add_txn(self.client, self.__get_add_form())
detail_uri: str = f"{PREFIX}/{txn_id}?as=income&next=%2F_next" detail_uri: str = f"{PREFIX}/{txn_id}?next=%2F_next"
update_uri: str = f"{PREFIX}/{txn_id}/update?as=income" update_uri: str = f"{PREFIX}/{txn_id}/update?as=income"
form_0: dict[str, str] = self.__get_update_form(txn_id) form_0: dict[str, str] = self.__get_update_form(txn_id)
form_0 = {x: form_0[x] for x in form_0 if "-debit-" not in x} form_0 = {x: form_0[x] for x in form_0 if "-debit-" not in x}
@ -1840,7 +1840,7 @@ class TransferTransactionTestCase(unittest.TestCase):
""" """
from accounting.models import Transaction, TransactionCurrency from accounting.models import Transaction, TransactionCurrency
txn_id: int = add_txn(self.client, self.__get_add_form()) txn_id: int = add_txn(self.client, self.__get_add_form())
detail_uri: str = f"{PREFIX}/{txn_id}?as=expense&next=%2F_next" detail_uri: str = f"{PREFIX}/{txn_id}?next=%2F_next"
update_uri: str = f"{PREFIX}/{txn_id}/update?as=expense" update_uri: str = f"{PREFIX}/{txn_id}/update?as=expense"
form_0: dict[str, str] = self.__get_update_form(txn_id) form_0: dict[str, str] = self.__get_update_form(txn_id)
form_0 = {x: form_0[x] for x in form_0 if "-credit-" not in x} form_0 = {x: form_0[x] for x in form_0 if "-credit-" not in x}