From 6ff9d0d4ffa3353b21bb87c0202ba6cfc3b4ee56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 17 Aug 2020 22:49:28 +0800 Subject: [PATCH] Replaced tuples with lists in the arguments for reverse() in the accounting application. --- accounting/utils.py | 16 ++++++++-------- accounting/views.py | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/accounting/utils.py b/accounting/utils.py index f6ec891..7f31540 100644 --- a/accounting/utils.py +++ b/accounting/utils.py @@ -100,28 +100,28 @@ class ReportUrl: if ledger is None else ledger def cash(self) -> str: - return reverse("accounting:cash", args=(self._cash, self._period)) + return reverse("accounting:cash", args=[self._cash, self._period]) def cash_summary(self) -> str: - return reverse("accounting:cash-summary", args=(self._cash,)) + return reverse("accounting:cash-summary", args=[self._cash]) def ledger(self) -> str: - return reverse("accounting:ledger", args=(self._ledger, self._period)) + return reverse("accounting:ledger", args=[self._ledger, self._period]) def ledger_summary(self) -> str: - return reverse("accounting:ledger-summary", args=(self._ledger,)) + return reverse("accounting:ledger-summary", args=[self._ledger]) def journal(self) -> str: - return reverse("accounting:journal", args=(self._period,)) + return reverse("accounting:journal", args=[self._period]) def trial_balance(self) -> str: - return reverse("accounting:trial-balance", args=(self._period,)) + return reverse("accounting:trial-balance", args=[self._period]) def income_statement(self) -> str: - return reverse("accounting:income-statement", args=(self._period,)) + return reverse("accounting:income-statement", args=[self._period]) def balance_sheet(self) -> str: - return reverse("accounting:balance-sheet", args=(self._period,)) + return reverse("accounting:balance-sheet", args=[self._period]) class Populator: diff --git a/accounting/views.py b/accounting/views.py index 0c0d553..b180746 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -705,7 +705,7 @@ def balance_sheet(request: HttpRequest, period: Period) -> HttpResponse: .filter(Q(amount__isnull=False), ~Q(amount=0)) .order_by("code")) for account in accounts: - account.url = reverse("accounting:ledger", args=(account, period)) + account.url = reverse("accounting:ledger", args=[account, period]) balance = Record.objects \ .filter( Q(transaction__date__lt=period.start) @@ -722,7 +722,7 @@ def balance_sheet(request: HttpRequest, period: Period) -> HttpResponse: code=Account.ACCUMULATED_BALANCE) brought_forward.amount = balance brought_forward.url = reverse( - "accounting:income-statement", args=(period.period_before(),)) + "accounting:income-statement", args=[period.period_before()]) accounts.append(brought_forward) balance = Record.objects \ .filter( @@ -740,7 +740,7 @@ def balance_sheet(request: HttpRequest, period: Period) -> HttpResponse: net_change = Account.objects.get(code=Account.NET_CHANGE) net_change.amount = balance net_change.url = reverse( - "accounting:income-statement", args=(period,)) + "accounting:income-statement", args=[period]) accounts.append(net_change) for account in [x for x in accounts if x.code[0] in "23"]: account.amount = -account.amount @@ -863,7 +863,7 @@ class TransactionFormView(FormView): def get_success_url(self) -> str: """Returns the URL on success.""" return reverse("accounting:transactions.detail", - args=(self.txn_type, self.get_object()), + args=[self.txn_type, self.get_object()], current_app=self.request.resolver_match.namespace) @property @@ -986,7 +986,7 @@ class AccountFormView(FormView): def get_success_url(self) -> str: """Returns the URL on success.""" - return reverse("accounting:accounts.detail", args=(self.get_object(),), + return reverse("accounting:accounts.detail", args=[self.get_object()], current_app=self.request.resolver_match.namespace)