There is a way of creating a view with @ensure_csrf_token
to add a csrf token in cookies, and then calling this view before submitting forms every time, to add given token in form or request header.
But the problem of this approach is that we should do a request before submitting every form, which is not a good idea.
So is there any other way, like using {% csrf_token %}
in front-end form, to add a csrf automatically, without any extra request?