Added the view and the templates for the forms of the transactions in the accounting application.

This commit is contained in:
2020-07-27 22:36:28 +08:00
parent cc18dbd5f1
commit 99fb99b160
7 changed files with 577 additions and 6 deletions

View File

@ -153,3 +153,24 @@ def smart_month(value):
if value.year == year and value.month == month:
return gettext("Last Month")
return defaultfilters.date(value, "Y/n")
@register.filter()
def index(value, arg):
"""Returns the arg-th element of the value list or tuple.
Args:
value (list|tuple): The list or tuple.
arg (int): The index.
Returns:
any: The arg-th element of the value
"""
if not (isinstance(value, list) or isinstance(value, tuple)):
return None
if not isinstance(arg, int):
return None
if arg >= len(value):
return None
return value[arg]