InstallationΒΆ
The package is published on PyPI and can be installed with pip (or any equivalent):
pip install django-htmx-messages
Add to your Django settings:
INSTALLED_APPS = [
# ...
"django_htmx_messages",
]
MIDDLEWARE = [
# ...
"django_htmx_messages.middleware.HtmxMessageMiddleware",
]
Add to your base template:
<head>
<script src="{% static 'htmx.min.js' %}" defer></script>
<script src="{% static 'toasts.js' %}" defer></script>
</head>
<body>
{# Your content here #} {% include 'toasts.html' %}
</body>
Next, see the section about usage to see how to use it.