Added the view and the templates for the forms of the transactions in the accounting application.
This commit is contained in:
@ -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]
|
||||
|
||||
|
Reference in New Issue
Block a user