{% csrf_token %}
outputs a with a form field but, what if I just want the value i..e {{ csrf_token.value }}
is this possible? If so how? I have searched online but cannot find any information on how to achieve this.
The csrf_token
value is added to the context by django.core.context_processors.csrf
, you can use it directly in the template code:
{{ csrf_token }}
This is the value used by the {% csrf_token %}
template tag when rendering the form field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With