Django HTMX Integration
Project description
Djxi | HTMX Integration for modern Django Frontends
📦 What is this?
Stop hunting for HTMX endpoints.
Djxi bundles the route, the view logic, and the HTML partial into a single Endpoint Battery.
Drop the DXEndpointBattery into your existing Django views or use it standalone. Keep every tiny hx-* swap exactly where it lives—without scattering your code across urls.py, views/, and templates/.
- No more archaeology. No more digging through three files just to tweak a button label.
- LoB, restored. Request → Logic → Render stays in one atomic, inline hub.
- Scales cleanly. Small partials stay manageable, without turning your project into spaghetti.
Just a prenup between Grandpa Django and his sexy new HTMX fling—keeping your repo clean, one battery at a time.
Pre-Alpha Note
The package is considered in experimental pre-alpha state, use with caution.
- Watch out for updates and consider giving it a star.
- Checkout the djxi showcases in the example django app.
Getting Started
Instalation
- Install with pip:
python -m pip install djxi
- Add django-htmx to your INSTALLED_APPS:
INSTALLED_APPS = [
...,
"djxi",
...,
]
- Optional: Adjust your base template to get you up and running instantly
{% load djxi %}
<!doctype html>
<html>
<head>
...
{% htmx_script_inclusion %}
</head>
<body {% htmx_headers %}>
...
</body>
</html>
The htmx_script_inclusion tag will pull the unminified v4 from CDN. Set DX_HTMX_VERSION="2" to pull in v2. For prodution you likely want to serve your own minified htmx.js.
As there are significant syntax changes between v4 and v2 of htmx, keep DX_HTMX_VERSION in sync with what htmx version you are serving.
Configuration
In your settings file you can overide the following default values for Djxi:
- DX_HTMX_VERSION": "4" # Choose between 4 and 2
- DX_HTMX_MINIFIED": False # Load a minified source, recommended for production
Quick start
Create and manage your HTMX Endpoint in a convenient Battery:
from djxi.actions import DXEndpointBattery, dx_route
INLINE_TEMPLATE = """
<dx-section name="confirm-button">
<button hx-post="/showcase/simple/confirm">
Confirm, {{ name }}
</button>
</dx-section>
<dx-section name="check-confirmed">
<button disabled>Confirmed!</button>
</dx-section>
"""
class SimpleInlineActionRouter(DXEndpointBattery):
inline_template = INLINE_TEMPLATE
@dx_route("get-confirm-button", methods=["GET"])
def get_confirm_button(self, request):
context = {"name": "Phil"}
return self.render_section(
request, section_name="confirm-button", context=context
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djxi-0.1.4.tar.gz.
File metadata
- Download URL: djxi-0.1.4.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2418c97326d864a9dcd27c3394f7835fae28d3b71bd38639f69b4a3ea90e9d63
|
|
| MD5 |
67ac5205662e6d4df1779911aea1691b
|
|
| BLAKE2b-256 |
6ed481b4abd46c1c6c05135452072c4ab1afe0971802cba7f88e63d7e80beff9
|
Provenance
The following attestation bundles were made for djxi-0.1.4.tar.gz:
Publisher:
main.yml on rollinger/djxi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
djxi-0.1.4.tar.gz -
Subject digest:
2418c97326d864a9dcd27c3394f7835fae28d3b71bd38639f69b4a3ea90e9d63 - Sigstore transparency entry: 1986323649
- Sigstore integration time:
-
Permalink:
rollinger/djxi@0841e04eb5cdd8c80859cd46c12baa9cd7596560 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/rollinger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@0841e04eb5cdd8c80859cd46c12baa9cd7596560 -
Trigger Event:
push
-
Statement type:
File details
Details for the file djxi-0.1.4-py3-none-any.whl.
File metadata
- Download URL: djxi-0.1.4-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8020a65df72e51c9f18493dcdacf107cb30fc7ddc0e8c4ab24cd1a4ba17133fd
|
|
| MD5 |
9452b9241554b7539e661fd2752dc717
|
|
| BLAKE2b-256 |
4b89a5afafc2cbdd0c9a08c0b6b6f34747e47ec38195a6c43ff0d841ca826e3e
|
Provenance
The following attestation bundles were made for djxi-0.1.4-py3-none-any.whl:
Publisher:
main.yml on rollinger/djxi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
djxi-0.1.4-py3-none-any.whl -
Subject digest:
8020a65df72e51c9f18493dcdacf107cb30fc7ddc0e8c4ab24cd1a4ba17133fd - Sigstore transparency entry: 1986323730
- Sigstore integration time:
-
Permalink:
rollinger/djxi@0841e04eb5cdd8c80859cd46c12baa9cd7596560 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/rollinger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@0841e04eb5cdd8c80859cd46c12baa9cd7596560 -
Trigger Event:
push
-
Statement type: