Replaced tuples with lists in the arguments for reverse() in the accounting application.

This commit is contained in:
依瑪貓 2020-08-17 22:49:28 +08:00
parent d1cb5cb0d0
commit 6ff9d0d4ff
2 changed files with 13 additions and 13 deletions

View File

@ -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:

View File

@ -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)