开发者

Django 'next' not working?

开发者 https://www.devze.com 2023-02-25 06:31 出处:网络
Not sure what\'s wrong here. I\'m using the built-in comment form. The form tag is like this: <form action=\"{% comment_form_target %}?next={% url post post.id %}\" method=\"post\">

Not sure what's wrong here. I'm using the built-in comment form. The form tag is like this:

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

The resulting HTML looks like this:

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

Where /6/ is my Post's post_detail address. However I still end up at this URL:

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

with a 开发者_C百科

Thank you for your comment. message

What is going on here? Thanks!


next should be a POST param , not a GET param . try add following line into your form

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

and leave the action of the form as "{% comment_form_target %}"

0

精彩评论

暂无评论...
验证码 换一张
取 消