Django and HTMX #17 - Updating Other Content - Out-Of-Band Swaps and Custom Events
Описание
In this video, learn how to update non-target elements using two different HTMX mechanisms:
1. Out-of-band swaps: with the hx-swap-oob attribute, you can replace non-target elements in your responses.
2. Triggering client events: your responses to HTMX requests can contain an HX-Trigger HTTP header, which can trigger a client-side event that performs subsequent actions to update the UI. We'll see how to use a tool from the django-htmx package to achieve this.
▶️ Full Playlist:
https://www.youtube.com/playlist?list=PL-2EBeDYMIbRByZ8GXhcnQSuv2dog4JxY
? ????????:
00:00 Intro
01:06 Setup
01:57 Creating Event model
03:59 Registering model with admin
06:49 Improving event template
08:10 Subscribing to event with HTMX
09:00 Updating with hx-swap-oob
14:40 Unsubscribing to event with HTMX
20:53 Updating user count
21:49 Triggering custom events
24:34 django-htmx trigger_client_event function
☕️ ??? ?? ? ??????:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
?????? ?????:
? Blog: https://www.bugbytes.io/posts/
? Github: https://github.com/bugbytes-io/django-htmx-update-other-content
? Twitter: https://twitter.com/bugbytesio
? ??????? ??????? ??? ???????????:
HTMX Update Other Content: https://htmx.org/examples/update-other-content/
CSRF Token tip: https://django-htmx.readthedocs.io/en/latest/tips.html
django-htmx triggering client events: https://django-htmx.readthedocs.io/en/latest/http.htm #django_htmx.http.trigger_client_event
#django #htmx #python
Рекомендуемые видео



















