django-gandalf
django-gandalf lets you declare multi-step, tree-shaped Django form flows
as readable, composable code.
You build a flow with a small, immutable builder — .step() to add a form,
.branch() to fork on an answer, .expand() to grow steps from an answer —
and mount it as an ordinary Django view. Gandalf handles the per-step URLs,
the session state, back-navigation, editing, file uploads, and running your
completion logic exactly once. When one wizard is not enough, it handles the
task list of wizards too: sections the user does in any order, lists they
grow, sections that unlock or appear because of what they said elsewhere, and
a submit at the end of all of it.
from gandalf.wizard import Wizard, condition
application = (
Wizard()
.step(ApplyingAsForm, name="applying-as")
.branch(
condition(is_organisation, Wizard().step(OrganisationForm, name="organisation")),
default=Wizard().step(AboutYouForm, name="about-you"),
)
.step(EmailForm, name="contact")
)
The only dependency is Django. Requires Python 3.10+ and Django 4.2+.
Installation
pip install django-gandalf # or: uv add django-gandalf
Gandalf ships no models or migrations, but it relies on standard Django
plumbing — the sessions app and middleware, and the request context
processor. Configuration has the exact
settings.
Documentation
The docs are in two halves, and you can start at either.
Learn is a walkthrough: one community grant application, built up a chapter at a time. Each chapter adds one idea, says why it exists, and leaves a runnable application behind. It deliberately does not cover every hook and every edge — read it start to finish the first time.
Reference is one page per thing —
Wizard, WizardViewSet, the summary, task lists, add another, storage, the
driver, the testing helpers — each with the complete API, worked usage, and
troubleshooting. Come here when you know what you are looking for.
| I want to… | Go to |
|---|---|
| build my first wizard | Learn, chapter 1 |
| see every builder method | Reference: Wizard |
| override a viewset hook | Reference: WizardViewSet |
| build a task list of wizards | Learn, chapter 12 · Reference: Task lists |
| test a wizard | Reference: Testing |
migrate from django-formtools |
Coming from formtools |
| know what replaying costs | Reference: Walk costs |
| drive a wizard from a script or an agent | Reference: Driver |
Every Learn chapter is real code under
tests/testapp/readme/, driven end to end by
tests/functional/test_readme_examples.py.
just serve runs them at http://127.0.0.1:8000/ so you can click through.
Contributing
See CONTRIBUTING.md for local setup, the separated unit
and functional test commands, and commit conventions.
ARCHITECTURE.md is the runtime-level view of how the
pieces fit; AGENT_ACCESS.md is the design behind the
driver and the agent.
Metadata
Release files for django-gandalf 0.36.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_gandalf-0.36.0.tar.gz | 447.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_gandalf-0.36.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 614.1 kB
Release files / django_gandalf-0.36.0.tar.gz
| Download URL | django_gandalf-0.36.0.tar.gz |
|---|---|
| Size | 447.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0c7a00c6e69f1952ea64617c7a788737cff8b92d4f9a23d0fb5be083e5f7696
|
|
BLAKE2b-256 checksum How to use checksums |
c7e2d5b144df75d485329343a85b1340581a2be6243adc191637ab115000d5b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.
Transparency logRelease files / django_gandalf-0.36.0-py3-none-any.whl
| Download URL | django_gandalf-0.36.0-py3-none-any.whl |
|---|---|
| Size | 167.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7748eb1f9e0b42ac9250535d25f24621d7a693715c612f8b4f3918d6377fa161
|
|
BLAKE2b-256 checksum How to use checksums |
11b1baf9db5e55ce5c4d0b226145cfa7759f0bc34fa91a09cedc5b0320577114
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.
Transparency log