From a340c7f0e2995c7868ac673eddd23022ab1549ba Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 7 Apr 2009 19:29:34 +0000 Subject: [PATCH] [1.0.X] Fixed #9268: pass the "next" param through in the comment preview/post view. Also updated the docs to make this a bit clearer. Backport of r10418 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10419 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../contrib/comments/templates/comments/form.html | 1 + .../comments/templates/comments/preview.html | 1 + django/contrib/comments/views/comments.py | 1 + docs/ref/contrib/comments/index.txt | 14 ++++++++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/django/contrib/comments/templates/comments/form.html b/django/contrib/comments/templates/comments/form.html index ae0d6952b0..f0da620ec0 100644 --- a/django/contrib/comments/templates/comments/form.html +++ b/django/contrib/comments/templates/comments/form.html @@ -1,5 +1,6 @@ {% load comments i18n %}
+ {% if next %}{% endif %} {% for field in form %} {% if field.is_hidden %} {{ field }} diff --git a/django/contrib/comments/templates/comments/preview.html b/django/contrib/comments/templates/comments/preview.html index 8c7a434b18..9f9af1352d 100644 --- a/django/contrib/comments/templates/comments/preview.html +++ b/django/contrib/comments/templates/comments/preview.html @@ -6,6 +6,7 @@ {% block content %} {% load comments %} + {% if next %}{% endif %} {% if form.errors %}

{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}

{% else %} diff --git a/django/contrib/comments/views/comments.py b/django/contrib/comments/views/comments.py index 32795431ce..ae3a672a80 100644 --- a/django/contrib/comments/views/comments.py +++ b/django/contrib/comments/views/comments.py @@ -80,6 +80,7 @@ def post_comment(request, next=None): template_list, { "comment" : form.data.get("comment", ""), "form" : form, + "next": next, }, RequestContext(request, {}) ) diff --git a/docs/ref/contrib/comments/index.txt b/docs/ref/contrib/comments/index.txt index 3e12ced3a7..ad651a44b9 100644 --- a/docs/ref/contrib/comments/index.txt +++ b/docs/ref/contrib/comments/index.txt @@ -42,7 +42,7 @@ To get started using the ``comments`` app, follow these steps: #. Use the `comment template tags`_ below to embed comments in your templates. -You might also want to examine the :ref:`ref-contrib-comments-settings` +You might also want to examine :ref:`ref-contrib-comments-settings`. Comment template tags ===================== @@ -166,7 +166,7 @@ A complete form might look like::
Be sure to read the `notes on the comment form`_, below, for some special -considerations you'll need to make if you're using this aproach. +considerations you'll need to make if you're using this approach. .. templatetag:: comment_form_target @@ -180,6 +180,16 @@ you'll always want to use it like above::
+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:: + + + +.. _notes-on-the-comment-form: + Notes on the comment form -------------------------