Replaced now() with localdate() when finding the default period in the view of the cash reports.

This commit is contained in:
依瑪貓 2020-07-08 00:14:36 +08:00
parent e48460b9bb
commit 097e699ccf

View File

@ -22,8 +22,9 @@
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse from django.urls import reverse
from django.utils import dateformat, timezone from django.utils import dateformat
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.timezone import localdate
from django.views import generic from django.views import generic
from django.views.decorators.http import require_GET from django.views.decorators.http import require_GET
@ -57,7 +58,7 @@ def cash_home(request):
and month. and month.
""" """
subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"] subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"]
period_spec = dateformat.format(timezone.now(), "Y-m") period_spec = dateformat.format(localdate(), "Y-m")
return HttpResponseRedirect( return HttpResponseRedirect(
reverse("accounting:cash", args=(subject_code, period_spec))) reverse("accounting:cash", args=(subject_code, period_spec)))