finds.dev← search

// the find

spookylukey/django-htmx-patterns

★ 1,059 · JavaScript · NOASSERTION · updated Jan 2026

Pattern repository for Django and htmx with full example code

A pattern reference for building Django apps with htmx, written by Luke Plant (author of 'Django Views — The Right Way'). It covers partials, form validation, modals, and multi-action views with working example code you can run locally. Aimed at Django developers who want to avoid a JS framework but need more interactivity than plain HTML forms.

The inline partials pattern with `use_block_from_params=True` is the real contribution here — it lets view code stay ignorant of which template fragment is being returned, which keeps things clean as htmx attributes multiply across templates. The form validation example is thorough: it preserves Django's Form abstraction rather than abandoning it for something custom. Copy-paste philosophy (public domain, no packaging) is the right call for this kind of glue code — libraries in this space tend to overgeneralize and rot. The author clearly uses this in production; the patterns have the shape of things that survived contact with real requirements.

The bundled htmx is 1.9.4, which is behind the current 2.x series that introduced breaking changes in event naming and swap behavior — anyone following along today will hit subtle differences. Documentation lives in `.rst` files read on GitHub, which works but makes it harder to navigate than a proper docs site; cross-referencing between patterns requires a lot of link-following. There's no coverage of WebSocket or SSE patterns, which come up quickly once you start pushing htmx harder. The demo app uses SQLite migrations for toy monsters — fine for illustration, but the gap between the examples and a real multi-model app with permissions is left entirely to the reader.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →