djangodjango-comments

Django 'next' not working?


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

Thank you for your comment. message

What is going on here? Thanks!


Solution

  • 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 %}"