dj-layouts
A Django layout composition library. Views return their own content as partials; a Layout class assembles the full page by calling other views as named panels, concurrently under ASGI.
Quick start
pip install dj-layouts
# myapp/layouts.py
from dj_layouts import Layout, Panel
class DefaultLayout(Layout):
template = "layouts/default.html"
navigation = Panel("core:navigation")
footer = Panel("<p>© Acme</p>")
# myapp/views.py
from dj_layouts import layout
@layout(DefaultLayout)
def homepage(request):
return render(request, "home/index.html", {"items": get_items()})
HTMX Smart Routing (SPA)
With HTMX Smart Routing, you can turn your standard multi-page Django application into a smooth single-page application (SPA) with zero client-side routing logic.
Opt-in by enabling the setting in your settings.py:
DJ_LAYOUTS = {
"PARTIAL_DETECTORS": ["dj_layouts.detection.htmx_detector"],
"HTMX_SMART_ROUTING": True,
}
Add hx-boost="true" to your <body>. When a user navigates between views:
- If the next view uses the same layout,
dj-layoutsreturns only the partial view response and tells HTMX to retarget and swap just the#panel-contentpanel (extremely fast). - If the next view uses a different layout,
dj-layoutsdynamically assembles the new full layout, updates the layout tracker cookie, and tells HTMX to smoothly swap the entire<body>.
Supported versions
| Python | Django |
|---|---|
| 3.13 | 5.2 (LTS) |
| 3.14 | 6.0 |
| latest |
Documentation
Full documentation at fukalite.github.io/dj-layouts/.
Contributing
See CONTRIBUTING.md.
Security
See SECURITY.md.
Licence
Metadata
Release files for dj-layouts 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dj_layouts-0.0.3.tar.gz | 96.5 kB | Without provenance | Details for dj_layouts-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dj_layouts-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for dj_layouts-0.0.3-py3-none-any.whl |
Total release size: 127.1 kB
Release files / dj_layouts-0.0.3.tar.gz
| Download URL | dj_layouts-0.0.3.tar.gz |
|---|---|
| Size | 96.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
499ded9b1eebf891d93fefee3e45f8fa015b9fd3bc06875a9ae3b46cb316264a
|
|
BLAKE2b-256 checksum How to use checksums |
3b2b7105b8fc45e67017bb50998d9e088cf7e6383a97912752efa4bb086ed886
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dj_layouts-0.0.3-py3-none-any.whl
| Download URL | dj_layouts-0.0.3-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7de7cda7fcbcc26336f7b37bdec3d9239cb6247ed194c4c9816559faa48a92dc
|
|
BLAKE2b-256 checksum How to use checksums |
b18be8f1729a93aee041b126e246178d5b15cc6a96f8ae5f068ff46d8a568ba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for dj-layouts 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.