Renamed the routes of the transactions.

This commit is contained in:
依瑪貓 2020-07-09 10:46:19 +08:00
parent e1e61869b7
commit e59d8738fa
2 changed files with 8 additions and 5 deletions

View File

@ -152,13 +152,16 @@ class Transaction(models.Model):
"""Returns the URL to view this transaction.""" """Returns the URL to view this transaction."""
if self.is_cash_expense: if self.is_cash_expense:
return reverse( return reverse(
"accounting:transaction", args=("expense", self.sn)) "accounting:transactions.view",
args=("expense", self.sn))
elif self.is_cash_income: elif self.is_cash_income:
return reverse( return reverse(
"accounting:transaction", args=("income", self.sn)) "accounting:transactions.view",
args=("income", self.sn))
else: else:
return reverse( return reverse(
"accounting:transaction", args=("transfer", self.sn)) "accounting:transactions.view",
args=("transfer", self.sn))
def __str__(self): def __str__(self):
"""Returns the string representation of this accounting """Returns the string representation of this accounting

View File

@ -44,7 +44,7 @@ urlpatterns = [
path("cash/<str:subject_code>/<str:period_spec>", path("cash/<str:subject_code>/<str:period_spec>",
views.CashReportView.as_view(), name="cash"), views.CashReportView.as_view(), name="cash"),
path("transactions/<txn-type:type>/<int:pk>", path("transactions/<txn-type:type>/<int:pk>",
views.CashReportView.as_view(), name="transaction"), views.CashReportView.as_view(), name="transactions.view"),
path("transactions/<txn-type:type>/<int:pk>/edit", path("transactions/<txn-type:type>/<int:pk>/edit",
views.CashReportView.as_view(), name="transaction.edit"), views.CashReportView.as_view(), name="transactions.edit"),
] ]