Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#8905 closed (fixed)

Error in default comment preview template

Reported by: Uninen 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 6 years ago.
git-patch against latest checkout

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Uninen

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 6 years ago by Guilherme M. Gondim <semente@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 6 years ago by mtredinnick

  • Triage Stage changed from Unreviewed to Accepted

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 6 years ago by thejaswi_puthraya

git-patch against latest checkout

comment:4 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

(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 6 years ago by mtredinnick

(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 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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