def init_jinja(env):
env.globals.update(context_processors)
env.finalize = lambda x: x if x is not None else ''
env.filters['human_date'] = humanize.naturaltime
env.filters['strfdate'] = lambda x: x.strftime('%d.%m.%Y')
env.filters['strftime'] = lambda x: x.strftime('%H:%M %d.%m.%Y')
env.filters['field_title'] = lambda x: fields.get(x) or x
env.globals['choose_plural'] = choose_plural
env.minify_html = config.app.minify_html
env.globals.update({'fields': fields, 'base_title': config.app.base_title, })
env.add_extension(HTMLMinExtension)
def complete_response(fn):
@wraps(fn)
async def wrapped(self, *args, **kwargs):