Revised the documentation.
This commit is contained in:
parent
4537681bb5
commit
fbce3ab9ef
@ -23,19 +23,17 @@
|
||||
class PeriodParser:
|
||||
"""The period parser.
|
||||
|
||||
Args:
|
||||
period_spec (str): The period specification.
|
||||
|
||||
Attributes:
|
||||
start: The start of the period.
|
||||
end: The end of the period.
|
||||
start (str): The start of the period.
|
||||
end (str): The end of the period.
|
||||
"""
|
||||
start = None
|
||||
end = None
|
||||
|
||||
def __init__(self, period_spec):
|
||||
"""Constructs a new period parser.
|
||||
|
||||
Args:
|
||||
period_spec (str): The period specification.
|
||||
"""
|
||||
self.start = period_spec + "-01"
|
||||
self.end = period_spec + "-30"
|
||||
|
||||
@ -43,6 +41,17 @@ class PeriodParser:
|
||||
class Pagination:
|
||||
"""The pagination.
|
||||
|
||||
Args:
|
||||
count (int): The total number of records
|
||||
page_no (int): The specified page number
|
||||
page_size (int): The specified number of records per page
|
||||
is_reverse (bool): Whether we should display the last
|
||||
page first
|
||||
|
||||
Raises:
|
||||
PageNoOutOfRangeError: if the specified page number is out
|
||||
of range or is redundant.
|
||||
|
||||
Attributes:
|
||||
page_no (int): The current page number
|
||||
page_size (int): The page size
|
||||
@ -53,19 +62,6 @@ class Pagination:
|
||||
DEFAULT_PAGE_SIZE = 10
|
||||
|
||||
def __init__(self, count, page_no, page_size, is_reverse = False):
|
||||
"""Constructs a new pagination.
|
||||
|
||||
Args:
|
||||
count (int): The total number of records
|
||||
page_no (int): The specified page number
|
||||
page_size (int): The specified number of records per page
|
||||
is_reverse (bool): Whether we should display the last
|
||||
page first
|
||||
|
||||
Raises:
|
||||
PageNoOutOfRangeError: if the specified page number is out
|
||||
of range or is redundant.
|
||||
"""
|
||||
self.page_size = page_size \
|
||||
if page_size is not None \
|
||||
else self.DEFAULT_PAGE_SIZE
|
||||
|
@ -39,8 +39,8 @@ def home(request):
|
||||
"""The accounting home page.
|
||||
|
||||
Returns:
|
||||
(HttpResponseRedirect) The redirection to the default
|
||||
accounting report.
|
||||
HttpResponseRedirect: The redirection to the default
|
||||
accounting report.
|
||||
"""
|
||||
return HttpResponseRedirect(reverse("accounting:cash.home"))
|
||||
|
||||
@ -50,8 +50,8 @@ def cash_home(request):
|
||||
"""The accounting cash report home page.
|
||||
|
||||
Returns:
|
||||
(HttpResponseRedirect) The redirection to the default subject
|
||||
and month.
|
||||
HttpResponseRedirect: The redirection to the default subject
|
||||
and month.
|
||||
"""
|
||||
subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"]
|
||||
period_spec = dateformat.format(timezone.now(), "Y-m")
|
||||
@ -123,7 +123,7 @@ class CashReportView(BaseReportView):
|
||||
"""Return the accounting records for the cash report.
|
||||
|
||||
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"])
|
||||
if self.kwargs["subject_code"] == "0":
|
||||
|
@ -37,8 +37,8 @@ class UrlBuilder:
|
||||
value (str): The parameter value
|
||||
|
||||
Returns:
|
||||
(UrlBuilder): The URL builder itself, with the parameter
|
||||
modified.
|
||||
UrlBuilder: The URL builder itself, with the parameter
|
||||
modified.
|
||||
"""
|
||||
self.params.append(self.Param(name, value))
|
||||
return self
|
||||
@ -50,8 +50,8 @@ class UrlBuilder:
|
||||
name (str): The parameter name
|
||||
|
||||
Returns:
|
||||
(UrlBuilder): The URL builder itself, with the parameter
|
||||
modified.
|
||||
UrlBuilder: The URL builder itself, with the parameter
|
||||
modified.
|
||||
"""
|
||||
self.params = [x for x in self.params if x.name != name]
|
||||
return self
|
||||
@ -65,8 +65,8 @@ class UrlBuilder:
|
||||
value (str): The parameter value
|
||||
|
||||
Returns:
|
||||
(UrlBuilder): The URL builder itself, with the parameter
|
||||
modified.
|
||||
UrlBuilder: The URL builder itself, with the parameter
|
||||
modified.
|
||||
"""
|
||||
return self.del_param(name).add_param(name, value)
|
||||
|
||||
@ -98,8 +98,8 @@ class UrlBuilder:
|
||||
parameter.
|
||||
|
||||
Returns:
|
||||
(str) The string representation of this query
|
||||
parameter
|
||||
str: The string representation of this query
|
||||
parameter
|
||||
"""
|
||||
return "%s=%s" % (
|
||||
urllib.parse.quote(self.name),
|
||||
|
Loading…
Reference in New Issue
Block a user