django_htmx_messages package

Subpackages

Submodules

django_htmx_messages.apps module

class django_htmx_messages.apps.HtmxMessagesAppConfig(app_name, app_module)[source]

Bases: AppConfig

App config for Django Htmx Messages.

name = 'django_htmx_messages'
verbose_name

django_htmx_messages.conf module

These are the available settings.

All attributes prefixed HTMX_MESSAGES_* can be overridden from your Django project’s settings module by defining a setting with the same name.

class django_htmx_messages.conf.AppSettings(HTMX_MESSAGES_ENABLED: bool = True)[source]

Bases: object

Access this instance as .conf.app_settings.

HTMX_MESSAGES_ENABLED: bool = True

Whether the app is enabled (dummy setting to demo usage).

django_htmx_messages.main module

django_htmx_messages.main.add(n1: int, n2: int) int[source]

Add the arguments.

django_htmx_messages.main.is_enabled() bool[source]

Example usage of app settings.

django_htmx_messages.middleware module

class django_htmx_messages.middleware.HtmxMessageMiddleware(get_response)[source]

Bases: MiddlewareMixin

Middleware that handles Django messages in HTMX responses.

Middleware that moves messages into the HX-Trigger header when request is made with HTMX.

process_response(request: HttpRequest, response: HttpResponse) HttpResponse[source]

Process HTMX responses by injecting Django messages as toast notifications.

Args:

request: The HTTP request response: The HTTP response

Returns:

The modified response with injected messages