Replaced the get_absolute_url() method in the transaction data model with the get_success_url() method in the transaction form model, and added the current application to the arguments to enable multiple instances of the application in the accounting application.

This commit is contained in:
2020-08-17 22:23:30 +08:00
parent 5898a48fe9
commit 64769440a7
2 changed files with 6 additions and 12 deletions

View File

@ -860,6 +860,12 @@ class TransactionFormView(FormView):
"""Returns the current object, or None on a create form."""
return self.kwargs.get("txn")
def get_success_url(self) -> str:
"""Returns the URL on success."""
return reverse("accounting:transactions.detail",
args=(self.txn_type, self.get_object()),
current_app=self.request.resolver_match.namespace)
@property
def txn_type(self) -> str:
"""Returns the transaction type of this form."""