1、解决方法错误提示里已经给出了。在表单里加上{% csrf_token %}就行了。

<form action="{%url listenCms:submitComment articleObj.id %}" method="post">{% csrf_token %}
	<div class="commentTextArea">
	<textarea name="content" cols="" rows=""></textarea>
	<input name="articleId" type="hidden" value="{{articleObj.id}}" />
	</div>
	<input name="submit" value="提交评论" type="submit" />
</form>

2、在Settings里的MIDDLEWARE_CLASSES增加配置:

'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',

相关文章:

  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2021-07-15
  • 2021-10-01
猜你喜欢
  • 2021-12-26
  • 2022-02-22
  • 2021-08-29
  • 2021-08-16
  • 2022-12-23
  • 2021-11-06
  • 2022-02-12
相关资源
相似解决方案