django-comments 可以处理页面上的多个评论表单吗?

发布于 2024-09-25 00:30:54 字数 446 浏览 2 评论 0原文

我在 Django 支持的网页上有多个模型,每个模型都有一个 django.contrib.comments 表单。在此页面上,从这些表单之一到 /comments/post/ 的帖子始终会导致:

Forbidden (403)
CSRF verification failed. Request aborted.

如果我在只有一个此类表单的另一个页面上包含相同的评论表单代码,则它只会发布美好的。

另外仅供参考,我已在 MIDDLEWARE_CLASSES 中包含 'django.middleware.csrf.CsrfViewMiddleware' ,并在评论表单中包含 {% csrf_token %}

对于此错误或在页面上正确提交多个 django-comments 表单有什么想法吗?

I have multiple models on a Django-powered webpage that have a django.contrib.comments form rendered for each. On this page, a post from one of these forms to /comments/post/ always results in:

Forbidden (403)
CSRF verification failed. Request aborted.

If I include the same comment form code on another page where there is just one such form, it posts just fine.

Also fyi, I have included 'django.middleware.csrf.CsrfViewMiddleware' in the MIDDLEWARE_CLASSES and the {% csrf_token %} inside the comment form.

Any thoughts on this error or getting multiple django-comments forms on a page submitting correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文