0

不知道这里有什么问题。我正在使用内置的评论表单。表单标签是这样的:

<form action="{% comment_form_target %}?next={% url post post.id %}" method="post">

生成的 HTML 如下所示:

<form action="/comments/post/?next=/6/" method="post">

/6/我的 Post 的 post_detail 地址在哪里。但是我仍然在这个 URL 结束:

http://localhost:8000/comments/posted/?c=4

感谢您的评论。信息

这里发生了什么?谢谢!

4

1 回答 1

4

next应该是 POST 参数,而不是 GET 参数。尝试将以下行添加到您的表单中

 <input type="hidden" name="next" value="{% url post post.id %}" />

并将表单的操作保留为"{% comment_form_target %}"

于 2011-04-15T12:48:19.833 回答