Make the
paramsargument oftrigger_client_event()optional.Thanks to Chris Tapper in PR #263.
Add
django_htmx.http.push_url()for setting theHX-Push-URLheader.Thanks to Chris Tapper in PR #264.
Add
django_htmx.http.reswap()for setting theHX-Reswapheader added in htmx 1.8.0.Add
django_htmx.http.retarget()for setting theHX-Retargetheader added in htmx 1.6.1.Add
HttpResponseLocationfor sending a response with theHX-Locationheader.Thanks to Ben Beecher in PR #239.
Add
request.htmx.current_url_abs_path, the absolute-path form ofrequest.current_url.Thanks to Trey Hunner for the feature request in Issue #259.
Improve type hints for
trigger_client_event()by using aTypeVar.Thanks to Chris Tapper in PR #260.
- Override
HttpResponseClientRedirect.urlproperty to fixHttpResponseClientRedirect.__repr__.
- Support Python 3.11.
- Support Django 4.1.
- Drop support for Django 2.2, 3.0, and 3.1.
- Make
trigger_client_event()return the response. - Add async support to
HtmxMiddlewareto reduce overhead on async views.
Move documentation from the README to Read the Docs. Also expand it with sections on installing htmx, and configuring CSRF.
Thanks to Ben Beecher for intial setup in PR #194.
Add
HttpResponseClientRefreshfor telling htmx to reload the page.Thanks to Bogumil Schube in PR #193.
- Drop Python 3.6 support.
Use
DjangoJSONEncoderfor encoding theHX-Triggerevent.Thanks to Cleiton de Lima in PR #182.
Drop redundant 'async' from debug
<script>tag.
Add
HttpResponseClientRedirectclass for sending HTMX client-side redirects.Thanks to Julio César in PR #121.
Add
django_htmx.http.trigger_client_event()for triggering client side events.
- Support Python 3.10.
- Support the
HX-Boostedheader, which was added in htmx 1.6.0. This is parsed into therequest.htmx.boostedattribute.
- Support Django 4.0.
- Make extension script error handler also show 404 errors.
Installation now requires adding
"django_htmx"to yourINSTALLED_APPSsetting.Add extension script with debug error handler. To install it, follow the new instructions in the README.
htmx’s default behaviour is to discard error responses. The extension overrides this in debug mode to shows Django’s debug error responses.
Add
django_htmx.httpmodule withHttpResponseStopPollingclass andHTMX_STOP_POLLINGconstant.
- Support the
HX-History-Restore-Requestheader, which was added in htmx 1.2.0. This is parsed into therequest.htmx.history_restore_requestattribute. - Support the
Triggering-Eventheader, which is sent by the event-header extension. This is parsed into therequest.htmx.triggering_eventattribute. - Stop distributing tests to reduce package size. Tests are not intended to be run outside of the tox setup in the repository. Repackagers can use GitHub's tarballs per tag.
- Remove
X-HTTP-Method-Overridehandling fromHtmxMiddleware. This has not been needed since htmx 0.0.5, when use of the header was extracted to itsmethod-overrideextension in htmx commit 2305ae.
- Add
HtmxMiddlewarewhich handles request headers from htmx. - Add example app on GitHub repository which demonstrates using django-htmx features.
- Remove the
{% htmx_script %}template tag. Include htmx on your pages yourself - this allows you to better customize the way htmx is installed to suit your project - for example by using theasyncscript attribute or by bundling it with extensions. - Remove the
HTMXViewMixin,{% htmx_include %}and{% htmx_attrs %}tags. Partial rendering can be done more with a simpler techinque - see the demo page in the example app, added in Pull Request #30.
- This version and those before explored what's possible with htmx and django, but were not documented.