Revised the documentation.

This commit is contained in:
依瑪貓 2020-07-02 00:50:27 +08:00
parent 4537681bb5
commit fbce3ab9ef
3 changed files with 29 additions and 33 deletions

View File

@ -23,19 +23,17 @@
class PeriodParser: class PeriodParser:
"""The period parser. """The period parser.
Args:
period_spec (str): The period specification.
Attributes: Attributes:
start: The start of the period. start (str): The start of the period.
end: The end of the period. end (str): The end of the period.
""" """
start = None start = None
end = None end = None
def __init__(self, period_spec): def __init__(self, period_spec):
"""Constructs a new period parser.
Args:
period_spec (str): The period specification.
"""
self.start = period_spec + "-01" self.start = period_spec + "-01"
self.end = period_spec + "-30" self.end = period_spec + "-30"
@ -43,18 +41,6 @@ class PeriodParser:
class Pagination: class Pagination:
"""The pagination. """The pagination.
Attributes:
page_no (int): The current page number
page_size (int): The page size
"""
page_no = None
page_size = None
DEFAULT_PAGE_SIZE = 10
def __init__(self, count, page_no, page_size, is_reverse = False):
"""Constructs a new pagination.
Args: Args:
count (int): The total number of records count (int): The total number of records
page_no (int): The specified page number page_no (int): The specified page number
@ -65,7 +51,17 @@ class Pagination:
Raises: Raises:
PageNoOutOfRangeError: if the specified page number is out PageNoOutOfRangeError: if the specified page number is out
of range or is redundant. of range or is redundant.
Attributes:
page_no (int): The current page number
page_size (int): The page size
""" """
page_no = None
page_size = None
DEFAULT_PAGE_SIZE = 10
def __init__(self, count, page_no, page_size, is_reverse = False):
self.page_size = page_size \ self.page_size = page_size \
if page_size is not None \ if page_size is not None \
else self.DEFAULT_PAGE_SIZE else self.DEFAULT_PAGE_SIZE

View File

@ -39,7 +39,7 @@ def home(request):
"""The accounting home page. """The accounting home page.
Returns: Returns:
(HttpResponseRedirect) The redirection to the default HttpResponseRedirect: The redirection to the default
accounting report. accounting report.
""" """
return HttpResponseRedirect(reverse("accounting:cash.home")) return HttpResponseRedirect(reverse("accounting:cash.home"))
@ -50,7 +50,7 @@ def cash_home(request):
"""The accounting cash report home page. """The accounting cash report home page.
Returns: Returns:
(HttpResponseRedirect) The redirection to the default subject HttpResponseRedirect: The redirection to the default subject
and month. and month.
""" """
subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"] subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"]
@ -123,7 +123,7 @@ class CashReportView(BaseReportView):
"""Return the accounting records for the cash report. """Return the accounting records for the cash report.
Returns: Returns:
(list[Record]) The accounting records for the cash report List[Record]: The accounting records for the cash report
""" """
period = PeriodParser(self.kwargs["period_spec"]) period = PeriodParser(self.kwargs["period_spec"])
if self.kwargs["subject_code"] == "0": if self.kwargs["subject_code"] == "0":

View File

@ -37,7 +37,7 @@ class UrlBuilder:
value (str): The parameter value value (str): The parameter value
Returns: Returns:
(UrlBuilder): The URL builder itself, with the parameter UrlBuilder: The URL builder itself, with the parameter
modified. modified.
""" """
self.params.append(self.Param(name, value)) self.params.append(self.Param(name, value))
@ -50,7 +50,7 @@ class UrlBuilder:
name (str): The parameter name name (str): The parameter name
Returns: Returns:
(UrlBuilder): The URL builder itself, with the parameter UrlBuilder: The URL builder itself, with the parameter
modified. modified.
""" """
self.params = [x for x in self.params if x.name != name] self.params = [x for x in self.params if x.name != name]
@ -65,7 +65,7 @@ class UrlBuilder:
value (str): The parameter value value (str): The parameter value
Returns: Returns:
(UrlBuilder): The URL builder itself, with the parameter UrlBuilder: The URL builder itself, with the parameter
modified. modified.
""" """
return self.del_param(name).add_param(name, value) return self.del_param(name).add_param(name, value)
@ -98,7 +98,7 @@ class UrlBuilder:
parameter. parameter.
Returns: Returns:
(str) The string representation of this query str: The string representation of this query
parameter parameter
""" """
return "%s=%s" % ( return "%s=%s" % (