Appearance
Django
The django starter kit is a complete Django 5 project. Django is the only dependency: there is no Node toolchain and no build step — the stylesheet and the runtime are finished static files.
Install
bash
npm run build:dist
npm run create -- my-admin --kit=django
cd my-admin
python -m venv .venv
. .venv/bin/activate # .venv\Scripts\activate on Windows
pip install -r requirements.txt
python manage.py runserverconfig/ settings, urls, wsgi
templates/
├── base.html the shell — head, boot script, static links
├── partials/{sidebar,topbar,footer}.html
└── pages/{dashboard,orders,settings}.html
static/adminvora/ the compiled bundle (css, js, img, vendor)The base template
templates/base.html carries the inline boot script first in <head>, then the stylesheet, and the runtime with defer:
django
{% load static %}
<link rel="stylesheet" href="{% static 'adminvora/css/adminvora.min.css' %}">
<script src="{% static 'adminvora/js/adminvora.js' %}" defer></script>runserver serves the bundle in development and collectstatic picks it up for production unchanged. Keep js/ and vendor/ siblings: the runtime lazy-loads ../vendor/… relative to its own URL, so charts download only on a page that draws one.
Navigation
Each view passes an active value, and the sidebar builds every link with {% url %}:
python
# config/urls.py
class Page(TemplateView):
active = ""
def get_context_data(self, **kwargs):
return {**super().get_context_data(**kwargs), "active": self.active}
urlpatterns = [
path("", Page.as_view(template_name="pages/dashboard.html", active="dashboard"), name="dashboard"),
path("orders/", Page.as_view(template_name="pages/orders.html", active="orders"), name="orders"),
]django
<li class="av-menu__item {% if active == 'orders' %}av-menu__item--active{% endif %}">
<a class="av-menu__link" href="{% url 'orders' %}"
{% if active == 'orders' %}aria-current="page"{% endif %}>
<span class="av-menu__label">Orders</span>
</a>
</li>Real data
pages/orders.html ships literal rows so the kit runs with no database. Replace the <tbody> with a loop over your own queryset — the data grid enhances whatever rows it finds. Keep data-av-value on sortable cells, so dates sort as dates and money as numbers:
django
{% for order in orders %}
<tr>
<th scope="row" data-av-key="id" data-av-value="{{ order.id }}">#{{ order.id }}</th>
<td data-av-key="total" data-av-value="{{ order.total_cents }}">{{ order.total_display }}</td>
</tr>
{% endfor %}Messages as toasts
django
{% if messages %}
{{ messages_json|json_script:"av-messages" }}
<script>
document.addEventListener('DOMContentLoaded', function () {
JSON.parse(document.getElementById('av-messages').textContent)
.forEach(function (m) { AdminVora.toast.show({ type: m.type, message: m.text }); });
});
</script>
{% endif %}Build messages_json in a context processor as a list of {"type", "text"}, mapping Django's ERROR level to danger (the toast types are success, danger, warning and info). json_script escapes the text safely.
HTMX
The runtime does not watch for swapped-in content, so re-scan after each swap:
js
document.body.addEventListener('htmx:afterSwap', (e) => AdminVora.init(e.detail.target));For a toast from a response, send an HX-Trigger header and listen for it:
python
response["HX-Trigger"] = json.dumps({"avToast": {"type": "success", "message": "Order created"}})js
document.body.addEventListener('avToast', (e) => AdminVora.toast.show(e.detail));Hashed filenames
If you switch to ManifestStaticFilesStorage or WhiteNoise's compressed storage, the runtime's filename gains a hash and ../vendor/… no longer resolves from it. Tell the loader where to look, before the runtime script:
django
<script>
window.__AV_ASSET_BASE__ = "{% static 'adminvora/js/' %}";
</script>The value is the directory the runtime is served from — js/, not the bundle root — because that is what ../vendor/ is resolved against. npm run test:asset-base checks this.
Content Security Policy
The boot script is inline by necessity — it must run before the first paint. Under a strict CSP give it a nonce (django-csp puts one on request.csp_nonce):
django
<script nonce="{{ request.csp_nonce }}">…</script>Checklist
- [ ] Boot script is the first script in
<head>, inline, with a nonce under CSP - [ ]
js/andvendor/are siblings, or__AV_ASSET_BASE__points atjs/ - [ ] Sortable and filterable cells carry
data-av-value - [ ] HTMX swaps are followed by
AdminVora.init(target)
Read next: Node / Express.