Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8905 closed (fixed)

Error in default comment preview template

Reported by: Ville Säävuori Owned by: nobody
Component: contrib.comments Version: 1.0
Severity: Keywords: comments, templates
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In django/contrib/comments/templates/comments/preview.html row 31 name attribute of the submit button is wrong. The name should be 'preview' not 'submit'. This makes preview template to submit the comment every time no matter which button is used.

Correct HTML for the preview button:

<input type="submit" name="preview" class="submit-preview" value="Preview">

Also, most of the texts in the default comment templates are not marked as translatable, but that is a matter of another ticket.

Attachments (1)

8905.diff (2.8 KB) - added by Thejaswi Puthraya 8 years ago.
git-patch against latest checkout

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by Ville Säävuori

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed

On a closer look, this was clearly a PEBKAC from my part. The comment processing view expects to see "preview" in the post data. If I change the form submit text, it fails.

comment:2 Changed 8 years ago by Guilherme M. Gondim <semente@…>

Resolution: invalid
Status: closedreopened

But we can't rename the value? I need translate, but if change the value "Preview" I can't use this feature. Anyway, I don't think that this is a translation question, I think that the input name for preview need to be "preview" and for post, need to be "post" and not "submit" in both... as before of refactoring... with that I can use the tag button too.

comment:3 Changed 8 years ago by Malcolm Tredinnick

Triage Stage: UnreviewedAccepted

Yes, this is a bug. We shouldn't be overloading the name like that and differentiating on the value, since, as noted, the values need to be marked for translation. Using distinct names to determine which action was selected is the normal way in HTML forms.

Changed 8 years ago by Thejaswi Puthraya

Attachment: 8905.diff added

git-patch against latest checkout

comment:4 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: reopenedclosed

(In [9119]) Add internationalisation support to the comment templates. Fixed #8868, #8905

Thanks to zgoda for a patch that did most of the internationalisation part.

comment:5 Changed 8 years ago by Malcolm Tredinnick

(In [9126]) [1.0.X] Add internationalisation support to the comment templates. Fixed #8868, #8905

Thanks to zgoda for a patch that did most of the internationalisation part.

Backport of r9119 from trunk.

comment:6 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

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