Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#11125 closed (duplicate)

comment redirect does not work with preview

Reported by: james_stevenson Owned by: nobody
Component: contrib.comments Version: 1.1-beta
Severity: Keywords: next redirect
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm using rev. 10790, the latest version as of the time this ticket was submitted.

The django docs say that you can redirect after a comment is posted by including a field like this in your comment form:

<input type="hidden" name="next" value="{% url my_comment_was_posted %}" />

However, this is incorrect. The post_comment view in django.contrib.comments.views.comments does not preserve this field for the comment preview form. Thus in the preview form template, the next variable is always None. The reason why is clear:

def post_comment(request, next=None):

There is never a "next" keyword argument passed to this view, so next is always None.

Attachments (2)

comments.py (4.4 KB ) - added by james_stevenson 15 years ago.
patch which fixes the problem by assigning the correct value to next is available
comments.patch (451 bytes ) - added by leanmeandonothingmachine 15 years ago.

Download all attachments as: .zip

Change History (8)

by james_stevenson, 15 years ago

Attachment: comments.py added

patch which fixes the problem by assigning the correct value to next is available

comment:1 by Jacob, 15 years ago

Can you please upload a real patch (run svn diff from the root of your Django SVN checkout)? This isn't a patch (it's just the whole file), so it's impossible to see what's changed.

comment:2 by Jacob, 15 years ago

Resolution: invalid
Status: newclosed

On further review, don't bother: this isn't a bug. The redirect handling is handled in django.contrib.comments.views.utils.next_redirect; the value of next is first taken from request.POST, and then from the variable passed to the view.

comment:3 by leanmeandonothingmachine, 15 years ago

Actually this is a bug. django.contrib.comments.views.utils.next_redirect is never called if the preview template gets rendered which means that in the preview template next is always none.

comment:4 by leanmeandonothingmachine, 15 years ago

Resolution: invalid
Status: closedreopened

by leanmeandonothingmachine, 15 years ago

Attachment: comments.patch added

comment:5 by Russell Keith-Magee, 15 years ago

Resolution: duplicate
Status: reopenedclosed

Duplicate of #9268

comment:6 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top