Opened 3 weeks ago

Last modified 2 days ago

#36127 assigned Bug

The link is not displayed when str is blank in admin.

Reported by: Antoliny Owned by: Antoliny
Component: contrib.admin Version: 5.1
Severity: Normal Keywords: link
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes
Pull Requests:19105

Description

In the admin page, there are parts where the model's __str__ value is used, providing links that allow navigation to the object when the value is clicked.
However, when __str__ is blank, while it’s not an issue for the value to appear as blank, the <a> tag's innerHTML being empty prevents the layout from being displayed on the screen, and it also cannot function as a link.

While it’s very rare for a user to assign a blank value to __str__, I still believe that it should at least function as a link.
Just like with fields, when the value is blank, a default value such as "-" should be used to ensure that it can at least function as a link.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • For anyone except the patch author to review the patch using the patch review checklist and either mark the ticket as "Ready for checkin" if everything looks good, or leave comments for improvement and mark the ticket as "Patch needs improvement".

Change History (11)

by Antoliny, 3 weeks ago

Attachment: not_link_example.png added

comment:1 by Antoliny, 3 weeks ago

Owner: set to Antoliny
Status: newassigned
Type: UncategorizedBug

comment:2 by Sarah Boyce, 3 weeks ago

Triage Stage: UnreviewedAccepted
UI/UX: set

Similar nature to #36114
It will be difficult to find all of these but we can try 👍

comment:3 by Antoliny, 3 weeks ago



I have confirmed that this issue also occurs in the breadcrumb. Additionally, while a message can still function as a link even when it is blank, it may need to be changed for consistency, so I have added that.

comment:4 by Antoliny, 3 weeks ago

Has patch: set

comment:5 by Antoliny, 3 weeks ago

Needs tests: set

comment:6 by Antoliny, 2 weeks ago

Needs tests: unset

comment:7 by Sarah Boyce, 2 weeks ago

Patch needs improvement: set

comment:8 by Antoliny, 2 days ago

Patch needs improvement: unset
Note: See TracTickets for help on using tickets.
Back to Top