Revised the parameters of Period.
This commit is contained in:
parent
ea354ae101
commit
069cd9ca74
@ -34,7 +34,7 @@ class ReportUrl:
|
||||
if "period" in kwargs:
|
||||
self._period = kwargs["period"]
|
||||
else:
|
||||
self._period = Period(None, None, None, None)
|
||||
self._period = Period()
|
||||
if "cash" in kwargs:
|
||||
self._cash_subject = kwargs["cash"]
|
||||
else:
|
||||
|
@ -74,8 +74,7 @@ def cash(request, subject_code, period_spec):
|
||||
last_txn = Transaction.objects.order_by("-date").first()
|
||||
data_end = last_txn.date if last_txn is not None else None
|
||||
period = Period(
|
||||
get_language(), data_start, data_end,
|
||||
period_spec)
|
||||
period_spec, data_start, data_end, get_language())
|
||||
# The SQL query
|
||||
if subject_code == "0":
|
||||
subject = Subject(code="0")
|
||||
|
@ -33,10 +33,10 @@ class Period:
|
||||
"""The template helper for the period chooser.
|
||||
|
||||
Args:
|
||||
language (str|None): The current language.
|
||||
data_start (date|None): The available first day of the data.
|
||||
data_end (date|None): The available last day of the data.
|
||||
spec (str|None): The current period specification
|
||||
spec (str): The current period specification
|
||||
data_start (date): The available first day of the data.
|
||||
data_end (date): The available last day of the data.
|
||||
language (str): The current language.
|
||||
|
||||
Attributes:
|
||||
spec (date): The currently-working period specification.
|
||||
@ -82,11 +82,13 @@ class Period:
|
||||
_data_end = None
|
||||
_period = None
|
||||
|
||||
def __init__(self, language, data_start, data_end, spec):
|
||||
self._language = language
|
||||
def __init__(
|
||||
self, spec = None,
|
||||
data_start = None, data_end = None, language = None):
|
||||
self._period = self.Parser(spec)
|
||||
self._data_start = data_start
|
||||
self._data_end = data_end
|
||||
self._period = self.Parser(spec)
|
||||
self._language = language
|
||||
|
||||
@property
|
||||
def spec(self):
|
||||
|
Loading…
Reference in New Issue
Block a user