Code

Opened 2 years ago

Closed 2 years ago

#17596 closed Bug (fixed)

Safestring in Admin Field Label quoted twice

Reported by: guettli Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: hv@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

A Safestring in and admin field label gets quoted twice. Patch with unittest attached.

The patch is against trunk (updated today) and all unittests pass.

Attachments (2)

safestring_in_admin_field_label.patch (3.9 KB) - added by guettli 2 years ago.
17594-2.diff (3.3 KB) - added by claudep 2 years ago.
Use conditional_escape for AdminField label

Download all attachments as: .zip

Change History (7)

comment:1 Changed 2 years ago by guettli

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

I am updating the patch ...

Changed 2 years ago by guettli

comment:2 Changed 2 years ago by guettli

  • Patch needs improvement unset

Improved test. All django unittests pass.

comment:3 Changed 2 years ago by claudep

  • Triage Stage changed from Unreviewed to Accepted

I don't see right away a good use case to pass a SafeString to a form label. Anyway, it does not harm to replace an escape by a conditional_escape, but no need to touch forms/forms.py for that (unless you show by a test that there is a problem there). I'm attaching my way of fixing this.

Changed 2 years ago by claudep

Use conditional_escape for AdminField label

comment:4 Changed 2 years ago by guettli

  • Triage Stage changed from Accepted to Ready for checkin

Thank you claudep. Your solution (17594-2.diff) is better. I tested it, all unittests pass. I think it is read to commit.

comment:5 Changed 2 years ago by jezdez

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

In [17431]:

Fixed #17596 -- Stopped the AdminField class from double quoting its label. Thanks, guettli and claudep.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.