hundreds-camera-24900
12/29/2021, 3:58 PMhundreds-camera-24900
12/29/2021, 3:59 PMhundreds-camera-24900
12/29/2021, 3:59 PMhundreds-camera-24900
12/29/2021, 4:00 PMhundreds-camera-24900
12/29/2021, 4:00 PMgorgeous-airport-54386
12/29/2021, 4:00 PMhundreds-camera-24900
12/29/2021, 4:00 PMhundreds-camera-24900
12/29/2021, 4:00 PMgorgeous-airport-54386
12/29/2021, 4:00 PMgorgeous-airport-54386
12/29/2021, 4:01 PMhundreds-camera-24900
12/29/2021, 4:01 PMhundreds-camera-24900
12/29/2021, 4:01 PMhundreds-camera-24900
12/29/2021, 4:01 PMhundreds-camera-24900
12/29/2021, 4:02 PMgorgeous-airport-54386
12/29/2021, 4:05 PMgorgeous-airport-54386
12/29/2021, 4:05 PMhundreds-camera-24900
12/29/2021, 4:18 PMflat-flower-95472
12/30/2021, 8:02 PMcool-camera-13454
12/30/2021, 8:17 PM{% csrf_token %}
tag insidecool-camera-13454
12/30/2021, 8:20 PMcsrf_token
produced by Django into the subsequent htmx requests:
html
<script>
document.body.addEventListener('htmx:configRequest', (event) => {
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
})
</script>
limited-pillow-24427
12/30/2021, 10:02 PM<ul class="ul-no-points" id="tasks" hx-swap="outerHTML" hx-target="#tasks">
{% for task in tasks %}
{% if task.done %}
<li>
<input type="checkbox" id="checkbox-done-{{task.id}}" value="" checked="checked"
hx-post="{% url 'complete' task.id %}" hx-trigger="click">
<label for="checkbox-done-{{task.id}}"><del> {{ task.name }} </del> </label>
<a href="#" role="button" class="delete-button" hx-post="{% url 'delete' task.id %}">x </a>
</li>
{% else %}
<li>
<input type="checkbox" id="checkbox-notdone-{{task.id}}" value="" hx-post="{% url 'complete' task.id %}"
hx-trigger="click">
<label for="checkbox-notdone-{{task.id}}">{{ task.name }} </label>
<a href="#" role="button" class="delete-button" hx-post="{% url 'delete' task.id %}">x</a>
</li>
{% endif %}
{% empty %}
<li> No items on your list yet </li>
{% endfor %}
{% if errors %} {{errors}} {% endif %}
<form hx-post="{% url 'index' %}" hx-swap="outerHTML" hx-target="#tasks">
{% csrf_token %}
{{ form }}
<button type="submit"> Add </button>
</form>
</ul>
limited-pillow-24427
12/30/2021, 10:06 PMlimited-pillow-24427
12/30/2021, 10:08 PMflat-flower-95472
12/31/2021, 12:53 AMlimited-pillow-24427
12/31/2021, 1:08 AMForbidden (CSRF token missing or incorrect.)
limited-pillow-24427
12/31/2021, 1:15 AMlimited-pillow-24427
12/31/2021, 1:16 AMlimited-diamond-93357
12/31/2021, 1:17 AMlimited-pillow-24427
12/31/2021, 1:18 AM