Commit f8adf99c authored by Jacob Kaplan-Moss's avatar Jacob Kaplan-Moss
Browse files

Fixed #9268: pass the "next" param through in the comment preview/post view....

Fixed #9268: pass the "next" param through in the comment preview/post view. Also updated the docs to make this a bit clearer.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10418 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 366710e6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
{% load comments i18n %}
<form action="{% comment_form_target %}" method="post">
  {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
  {% for field in form %}
    {% if field.is_hidden %}
      {{ field }}
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
{% block content %}
  {% load comments %}
  <form action="{% comment_form_target %}" method="post">
    {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
    {% if form.errors %}
    <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1>
    {% else %}
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ def post_comment(request, next=None):
            template_list, {
                "comment" : form.data.get("comment", ""),
                "form" : form,
                "next": next,
            },
            RequestContext(request, {})
        )
+8 −0
Original line number Diff line number Diff line
@@ -180,6 +180,14 @@ you'll always want to use it like above::

    <form action="{% comment_form_target %}" method="POST">

Redirecting after the comment post
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To specify the URL you want to redirect to after the comment has been posted,
you can include a hidden form input called ``next`` in your comment form. For example::
 
    <input type="hidden" name="next" value="{% url my_comment_was_posted %}" />

.. _notes-on-the-comment-form:

Notes on the comment form