Changelog¶
1.27.0 (2025-11-28)¶
Drop Python 3.9 support.
Fix CSP nonce support in the template tags when they’re the first use of
csp_nonce.
1.26.0 (2025-09-22)¶
The django-htmx extension script now displays responses with status codes 400 (bad request) and 403 (forbidden), like the existing support for codes 404 and 500. This change can help you debug
Add
reselect()to set theHX-Reselectheader.Improve typing of
reswap()to only accept valid HTMX swap methods.Thanks to Thibaut Decombe in PR #555.
Prevent
HttpResponseClientRedirectfrom being called withpreserve_request=True, which was added to redirect responses in Django 5.2. It doesn’t make sense in the context of a client-side redirect, which always returns a status code of 200, and would crash anyway.
1.25.0 (2025-09-18)¶
Support Django 6.0.
Add Content Security Policy (CSP) nonce support to the template tags.
Thanks to waifudegen for the report in Issue #542.
1.24.1 (2025-09-11)¶
Upgrade the vendored htmx to version 2.0.7.
1.24.0 (2025-09-10)¶
Support Python 3.14.
Fix crashes in the extension script for custom error pages.
Thanks to S Foster for the report in Issue #546.
1.23.2 (2025-06-27)¶
Upgrade the vendored htmx to version 2.0.6.
1.23.1 (2025-06-21)¶
Upgrade the vendored htmx to version 2.0.5.
1.23.0 (2025-03-14)¶
Vendor htmx.
You can now render an htmx script tag in your templates with:
{% load django_htmx %} {% htmx_script %}
No need to include htmx in your project separately.
See Template tags for more information.
1.22.0 (2025-02-06)¶
Support Django 5.2.
1.21.0 (2024-10-27)¶
Drop Django 3.2 to 4.1 support.
1.20.0 (2024-10-25)¶
Drop Python 3.8 support.
Support Python 3.13.
Updated the partial rendering tip to cover using django-template-partials.
Thanks to Carlton Gibson in PR #413.
1.19.0 (2024-08-05)¶
Add
django_htmx.http.replace_url()for setting theHX-Replace-URLheader.Thanks to Bogumil Schube in PR #396.
Add
selectparameter toHttpResponseLocation.Thanks to Nikola Anović in PR #462.
Add documentation notes under
HtmxMiddleware, covering setting theVaryheader for caching and type hintingrequest.htmx.
1.18.0 (2024-06-19)¶
Support Django 5.1.
1.17.3 (2024-03-01)¶
Change
reswap()type hint formethodtostr.Thanks to Dan Jacob for the report in Issue #421 and fix in PR #422.
1.17.2 (2023-11-16)¶
Fix asgiref dependency declaration.
1.17.1 (2023-11-14)¶
Fix ASGI compatibility on Python 3.12.
Thanks to Grigory Vydrin for the report in Issue #381.
1.17.0 (2023-10-11)¶
Support Django 5.0.
1.16.0 (2023-07-10)¶
Drop Python 3.7 support.
Remove the unnecessary
typeattribute on the<script>tag generated bydjango_htmx_script.Allow custom JSON encoders in
trigger_client_event().Thanks to Joey Lange in PR #349.
1.15.0 (2023-06-13)¶
Support Python 3.12.
1.14.0 (2023-02-25)¶
Support Django 4.2.
1.13.0 (2022-11-10)¶
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.
1.12.2 (2022-08-31)¶
Improve type hints for
trigger_client_event()by using aTypeVar.Thanks to Chris Tapper in PR #260.
1.12.1 (2022-07-29)¶
Override
HttpResponseClientRedirect.urlproperty to fixHttpResponseClientRedirect.__repr__.
1.12.0 (2022-06-05)¶
Support Python 3.11.
Support Django 4.1.
1.11.0 (2022-05-10)¶
Drop support for Django 2.2, 3.0, and 3.1.
1.10.0 (2022-05-07)¶
Make
trigger_client_event()return the response.Add async support to
HtmxMiddlewareto reduce overhead on async views.
1.9.0 (2022-03-02)¶
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 initial setup in PR #194.
Add
HttpResponseClientRefreshfor telling htmx to reload the page.Thanks to Bogumil Schube in PR #193.
1.8.0 (2022-01-10)¶
Drop Python 3.6 support.
1.7.0 (2022-01-10)¶
Use
DjangoJSONEncoderfor encoding theHX-Triggerevent.Thanks to Cleiton de Lima in PR #182.
Drop redundant ‘async’ from debug
<script>tag.
1.6.0 (2021-10-06)¶
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.
1.5.0 (2021-10-05)¶
Support Python 3.10.
1.4.0 (2021-10-02)¶
Support the
HX-Boostedheader, which was added in htmx 1.6.0. This is parsed into therequest.htmx.boostedattribute.
1.3.0 (2021-09-28)¶
Support Django 4.0.
1.2.1 (2021-07-09)¶
Make extension script error handler also show 404 errors.
1.2.0 (2021-07-08)¶
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.
1.1.0 (2021-06-03)¶
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.
1.0.1 (2021-02-08)¶
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.
1.0.0 (2021-02-07)¶
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 technique - see the demo page in the example app, added in Pull Request #30.
0.1.4 (2020-06-30)¶
This version and those before explored what’s possible with htmx and django, but were not documented.