danjac, Handling #Django messages with #alpinejs and #htmx
For normal page rendering, we just render the messages in an include in the base template.
https://codeberg.org/danjac/radiofeed-app/src/branch/main/templates/_messages.htmlFor HTMX requests, the snippet is injected into the response with some middleware, using the hx-swap-oob tag.
https://codeberg.org/danjac/radiofeed-app/src/branch/main/radiofeed/middleware.py#L35
- AlpineJS uses x-show and x-transition tags to fade out the messages once they are displayed.