Server side templates: how to implement partial updates? #1140
-
|
Hi! My question is about regular django app with templates. Suppose we are using templates mostly, no API. Suppose we have a view that corresponds to a template that has 5 components. 2 components have figured out their data has been invalidated and they need an update. What do they do? Access their corresponding view? In that case, the view will render all 5 components, where we need only two of them. How do you solve that problem? |
Beta Was this translation helpful? Give feedback.
Answered by
David-Guillot
Nov 26, 2022
Replies: 1 comment 1 reply
-
|
Hi @pwtail , There are multiple solutions for that:
Hope this helps, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
pwtail
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @pwtail ,
There are multiple solutions for that:
Hx-TriggerorHx-Target, that are automatically set by htmx when sending a request according to yourhx-triggerandhx-targetattributes, and that can be parsed by your Django view (even more easily with django-htmx) in order to decide which template to render