This project demonstrates how to show a Django Form in a modal dialog box using HTMX.
This branch contains the Bootstrap 5 version.
See also the Bootstrap 4 version in this repository, or a Tailwind + Alpine.js version in @geoffbeier's fork.
There are two additionnal branches that show how to use this technique with the Django messages framework: with the HX-Trigger
technique and with the "OOB swap" technique
Learn more about this technique here:
- Modal forms with Django+HTMX (blog post)
- Modal forms with Django+HTMX (YouTube video)
- Toasts with Django+HTMX (blog post)
- Toasts with Django+HTMX (YouTube video)
- Using the Django messages framework with HTMX (blog post)
- Django+HTMX: integration with the messages framework (YouTube video)
- Django+HTMX: integration with the messages framework (GitHub repository)
To run the demo locally:
pipenv install
pipenv run migrate
pipenv run server