Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #9268: pass the "next" param through in the comment preview/pos…

…t 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
  • Loading branch information...
commit f8adf99cdb449924b2ed2ddac33744da7eeb1efc 1 parent 366710e
Jacob Kaplan-Moss authored April 07, 2009
1  django/contrib/comments/templates/comments/form.html
... ...
@@ -1,5 +1,6 @@
1 1
 {% load comments i18n %}
2 2
 <form action="{% comment_form_target %}" method="post">
  3
+  {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
3 4
   {% for field in form %}
4 5
     {% if field.is_hidden %}
5 6
       {{ field }}
1  django/contrib/comments/templates/comments/preview.html
@@ -6,6 +6,7 @@
6 6
 {% block content %}
7 7
   {% load comments %}
8 8
   <form action="{% comment_form_target %}" method="post">
  9
+    {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
9 10
     {% if form.errors %}
10 11
     <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1>
11 12
     {% else %}
1  django/contrib/comments/views/comments.py
@@ -80,6 +80,7 @@ def post_comment(request, next=None):
80 80
             template_list, {
81 81
                 "comment" : form.data.get("comment", ""),
82 82
                 "form" : form,
  83
+                "next": next,
83 84
             },
84 85
             RequestContext(request, {})
85 86
         )
8  docs/ref/contrib/comments/index.txt
@@ -180,6 +180,14 @@ you'll always want to use it like above::
180 180
 
181 181
     <form action="{% comment_form_target %}" method="POST">
182 182
 
  183
+Redirecting after the comment post
  184
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  185
+
  186
+To specify the URL you want to redirect to after the comment has been posted,
  187
+you can include a hidden form input called ``next`` in your comment form. For example::
  188
+ 
  189
+    <input type="hidden" name="next" value="{% url my_comment_was_posted %}" />
  190
+
183 191
 .. _notes-on-the-comment-form:
184 192
 
185 193
 Notes on the comment form

0 notes on commit f8adf99

Please sign in to comment.
Something went wrong with that request. Please try again.