Skip to content

Commit

Permalink
feat: Make the HTMX object available in templates as a global context
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Nov 30, 2023
1 parent 6a1b62e commit 1174adf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions flask_htmx/htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def init_app(self, app: Flask):
"""Initialise the extension with the Flask app object."""
app.htmx = self

@app.context_processor
def htmx_context_processor():
return {"htmx": self}


@property
def boosted(self) -> bool:
""":py:obj:`True` if the request came from an element with the `hx-boost`
Expand Down

0 comments on commit 1174adf

Please sign in to comment.