Opened 8 years ago

Closed 7 years ago

Last modified 5 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: UI/UX:

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 8 years ago.
patch which fixes the problem by assigning the correct value to next is available
comments.patch (451 bytes) - added by leanmeandonothingmachine 7 years ago.

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by james_stevenson

Attachment: comments.py added

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

comment:1 Changed 8 years ago by Jacob

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 Changed 8 years ago by Jacob

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 Changed 7 years ago by leanmeandonothingmachine

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 Changed 7 years ago by leanmeandonothingmachine

Resolution: invalid
Status: closedreopened

Changed 7 years ago by leanmeandonothingmachine

Attachment: comments.patch added

comment:5 Changed 7 years ago by Russell Keith-Magee

Resolution: duplicate
Status: reopenedclosed

Duplicate of #9268

comment:6 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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