Update Jinja2 environment to include Flask's default globals and filters
This commit is contained in:
@@ -10,8 +10,15 @@ environment = Environment(
|
|||||||
loader=FileSystemLoader("templates"),
|
loader=FileSystemLoader("templates"),
|
||||||
autoescape=select_autoescape(("html", "jinja2"))
|
autoescape=select_autoescape(("html", "jinja2"))
|
||||||
)
|
)
|
||||||
environment.globals['url_for'] = url_for
|
|
||||||
|
|
||||||
|
|
||||||
def init_app(app):
|
def init_app(app):
|
||||||
htmx.init_app(app)
|
htmx.init_app(app)
|
||||||
|
|
||||||
|
# Add all Flask's default Jinja2 globals and filters
|
||||||
|
environment.globals.update(
|
||||||
|
app.jinja_env.globals
|
||||||
|
)
|
||||||
|
environment.filters.update(
|
||||||
|
app.jinja_env.filters
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user