headers: { "X-CSRFToken": csrf_token, } html code example
Example: Django Rendering Forms Manually and using csfr token
<form action="{% url "submit-form-url-name" %}" method="post" accept-charset="utf-8">
{% csrf_token %}
{{ form.field1 }}
{{ form.field2 }}
...
</form>