important-winter-64905
10/01/2021, 5:52 PMtd tag. This is great because I can submit individual forms corresponding to a row and column index without submitting an entire row at one time. The problem is that the HTML snippet that is returned has a different CSRF tag once the form is submitted.
How do I return a code snippet with the same CSRF tag?
I'm thinking of using this little script to do that for me instead of doing it using the Django template. https://justdjango.com/blog/dynamic-forms-in-django-htmx#create-a-base-html-file
<script>
document.body.addEventListener('htmx:configRequest', (event) => {
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
})
</script>