#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)
Change History (8)
by , 16 years ago
Attachment: | comments.py added |
---|
comment:1 by , 16 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 , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
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 , 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 , 15 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
by , 15 years ago
Attachment: | comments.patch added |
---|
patch which fixes the problem by assigning the correct value to next is available