Installation¶
Install the core package from PyPI:
python -m pip install django-htmx-views
Install the optional linked-select integration when it is needed:
python -m pip install "django-htmx-views[linked-selects]"
Install the optional Bootstrap 5 integration, including
django-bootstrap5, when using the Bootstrap template components:
python -m pip install "django-htmx-views[bootstrap5]"
Django settings¶
Add the package to INSTALLED_APPS and enable the django-htmx
middleware:
INSTALLED_APPS = [
# ...
"htmx_views",
]
MIDDLEWARE = [
# ...
"django_htmx.middleware.HtmxMiddleware",
]
Add "django_bootstrap5" to INSTALLED_APPS as well when using its form,
button, CSS, or JavaScript template tags. The structural tags supplied by
htmx_views do not load Bootstrap assets automatically.
Migrating an existing application¶
Install the package and add
htmx_viewstoINSTALLED_APPS.Replace imports beginning with
apps.htmx_viewswithhtmx_views.Include
htmx_views.urlsif the application uses linked selects.Run the consuming application’s tests before removing its copied
apps/htmx_viewsdirectory.