Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#35606 closed Bug (fixed)

Admin changelist broken for model instances with __html__ method

Reported by: Claude Paroz Owned by: Hisham Mahmood
Component: contrib.admin Version: 5.0
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since [85366fbca723c9b37d0ac9db1d44e3f1cb188db2] (#34045), any model instance implementing an __html__ method producing HTML markup is breaking the admin, because of the aria-label property will contain unescaped quotes that will break the page HTML.

Maybe the solution is forcing str(obj) in the format_html call.

Change History (9)

comment:1 by Sarah Boyce, 3 months ago

Triage Stage: UnreviewedAccepted

Thank you! Replicated

Maybe the solution is forcing str(obj) in the format_html call.

I think this works 👍

comment:2 by Hisham Mahmood, 3 months ago

Has patch: set
Owner: set to Hisham Mahmood
Status: newassigned

comment:3 by Hisham Mahmood, 3 months ago

Patch needs improvement: set

comment:4 by Hisham Mahmood, 3 months ago

Patch needs improvement: unset

comment:5 by Sarah Boyce, 3 months ago

Patch needs improvement: set

comment:6 by Sarah Boyce, 3 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:7 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

Resolution: fixed
Status: assignedclosed

In 182f262b:

Fixed #35606, Refs #34045 -- Fixed rendering of ModelAdmin.action_checkbox for models with a html method.

Thank you Claude Paroz for the report.

Regression in 85366fbca723c9b37d0ac9db1d44e3f1cb188db2.

comment:8 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In 5eef80b:

[5.1.x] Fixed #35606, Refs #34045 -- Fixed rendering of ModelAdmin.action_checkbox for models with a html method.

Thank you Claude Paroz for the report.

Regression in 85366fbca723c9b37d0ac9db1d44e3f1cb188db2.

Backport of 182f262b15882649bbc39d769f9b721cf3660f6f from main.

comment:9 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In c3d3af8e:

[5.0.x] Fixed #35606, Refs #34045 -- Fixed rendering of ModelAdmin.action_checkbox for models with a html method.

Thank you Claude Paroz for the report.

Regression in 85366fbca723c9b37d0ac9db1d44e3f1cb188db2.

Backport of 182f262b15882649bbc39d769f9b721cf3660f6f from main.

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