Django's {{ csrf_token }} is outputting the token value only, without the hidden input markup

孤人 提交于 2019-12-03 23:53:39

You have to use it as tag {% csrf_token %} not as a variable passed by your view {{csrf_token}}

I use the next in my templates to solve your problem:

<input type='hidden' name='csrfmiddlewaretoken' value='{{ csrf_token }}' />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!