Added the "default" filter to reduce the amount of logic in the templates, which differs from the Jinja2 "default" filter in that it looks for None instead of undefined values.

This commit is contained in:
2023-03-06 02:13:37 +08:00
parent 8d126e183f
commit 9450915404
14 changed files with 45 additions and 33 deletions

View File

@ -58,9 +58,10 @@ def init_app(app: Flask, user_utils: AbstractUserUtils,
template_folder="templates",
static_folder="static")
from .template_filters import format_amount, format_date
from .template_filters import format_amount, format_date, default
bp.add_app_template_filter(format_amount, "accounting_format_amount")
bp.add_app_template_filter(format_date, "accounting_format_date")
bp.add_app_template_filter(default, "accounting_default")
from .template_globals import currency_options, default_currency_code
bp.add_app_template_global(currency_options,