Is there any way to get the csrftoken
in my view directly?
How can I get the csrftoken token in the view directly? [duplicate]
Asked Answered
I believe you're looking for this:
django.middleware.csrf.get_token(request)
or
{% csrf_token %}
Reference: How can I embed django csrf token straight into HTML?
In form you must add '<input type="hidden" name="csrfmiddlewaretoken" value="' + get_token(request) + '"/>' –
Osteal
© 2022 - 2024 — McMap. All rights reserved.