[Django] #36127: The link is not displayed when str is blank in admin.

36 views
Skip to first unread message

Django

unread,
Jan 23, 2025, 6:40:09 AMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
--------------------------+-----------------------------------------
Reporter: Antoliny | Type: Uncategorized
Status: new | Component: contrib.admin
Version: 5.1 | Severity: Normal
Keywords: link | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+-----------------------------------------
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.
[[Image(not_link_example.png)]]
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36127>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 23, 2025, 6:40:15 AMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+--------------------------------------
Reporter: Antoliny | Owner: (none)
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Antoliny):

* Attachment "not_link_example.png" added.

Django

unread,
Jan 23, 2025, 6:40:37 AMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+--------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Antoliny):

* owner: (none) => Antoliny
* status: new => assigned
* type: Uncategorized => Bug

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:1>

Django

unread,
Jan 23, 2025, 9:22:31 AMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted
* ui_ux: 0 => 1

Comment:

Similar nature to #36114
It will be difficult to find all of these but we can try 👍
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:2>

Django

unread,
Jan 23, 2025, 6:18:15 PMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* Attachment "Screenshot 2025-01-24 at 8.15.43 AM.png" added.

Django

unread,
Jan 23, 2025, 6:18:24 PMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* Attachment "Screenshot 2025-01-24 at 8.16.41 AM.png" added.

Django

unread,
Jan 23, 2025, 6:19:55 PMJan 23
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by Antoliny):

[[Image(Screenshot 2025-01-24 at 8.15.43 AM.png)]]
[[Image(Screenshot 2025-01-24 at 8.16.41 AM.png)]]
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:3>

Django

unread,
Jan 26, 2025, 7:43:20 AMJan 26
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/19105 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:4>

Django

unread,
Jan 26, 2025, 8:43:42 AMJan 26
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:5>

Django

unread,
Jan 28, 2025, 12:45:08 AMJan 28
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:6>

Django

unread,
Jan 29, 2025, 9:21:40 AMJan 29
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:7>

Django

unread,
Feb 11, 2025, 10:19:05 PMFeb 11
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:8>

Django

unread,
Feb 14, 2025, 1:49:31 AMFeb 14
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by Raphael Gaschignard):

I do not know how appropriate it would be as a solution, but it is
possible with CSS to detect empty anchor tags and then add a *touch* of
content:

{{{
a:empty::after {
/* insert two non-blocking spaces, making the link appear */
content: '\00A0\00A0';
}
}}}

The point here being that there could be some fallback in the admin in
particular for this issue (that feels pretty easy to accidentally do when
not careful with __str__). Could even put in text like "(blank)". But then
we're looking at translation strings in CSS...
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:9>

Django

unread,
Feb 17, 2025, 9:21:23 AMFeb 17
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:10>

Django

unread,
Feb 17, 2025, 6:33:04 PMFeb 17
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:11>

Django

unread,
Mar 3, 2025, 4:58:56 PMMar 3
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------------
Reporter: Antoliny | Owner: Bhupesh panwar
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------------
Changes (by Bhupesh panwar):

* owner: Antoliny => Bhupesh panwar

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:12>

Django

unread,
Mar 3, 2025, 5:00:31 PMMar 3
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* owner: Bhupesh panwar => Antoliny

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:13>

Django

unread,
Mar 3, 2025, 5:02:08 PMMar 3
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by Antoliny):

Replying to [comment:12 Bhupesh panwar]:

Thank you for your interest in this ticket! :) I am currently working on
this ticket, and it is now awaiting review.
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:14>

Django

unread,
Mar 16, 2025, 6:33:20 PMMar 16
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:15>

Django

unread,
Mar 16, 2025, 10:51:50 PMMar 16
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:16>

Django

unread,
Mar 21, 2025, 11:34:05 AMMar 21
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:17>

Django

unread,
Apr 11, 2025, 7:45:53 PMApr 11
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:18>

Django

unread,
Apr 26, 2025, 7:24:17 AMApr 26
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by c-stange):

I think the current UI design creates a potential source of confusion by
placing a blue underscored "-" link directly adjacent to a green "+"
button under "My Actions".
Users might naturally assume that the "-" performs the opposite operation
of the "+", leading to incorrect expectations about the link's actual
function.

Maybe you could use an underscore character (_) as an alternative to the
hyphen (-) notation. This approach eliminates the requirement for
translations while preventing potential user misconceptions regarding the
minus symbol's intended functionality.
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:19>

Django

unread,
Apr 26, 2025, 7:28:29 AMApr 26
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by c-stange):

* cc: c-stange (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:20>

Django

unread,
Apr 28, 2025, 8:45:55 PMApr 28
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:21>

Django

unread,
May 2, 2025, 3:57:57 AMMay 2
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Antoliny):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:22>

Django

unread,
May 2, 2025, 4:09:35 AMMay 2
to django-...@googlegroups.com
#36127: The link is not displayed when str is blank in admin.
-------------------------------+------------------------------------
Reporter: Antoliny | Owner: Antoliny
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by Antoliny):

Replying to [comment:19 c-stange]:
> I think the current UI design creates a potential source of confusion by
placing a blue underscored "-" link directly adjacent to a green "+"
button under "My Actions".
> Users might naturally assume that the "-" performs the opposite
operation of the "+", leading to incorrect expectations about the link's
actual function.
>
> Maybe you could use an underscore character (_) as an alternative to the
hyphen (-) notation. This approach eliminates the requirement for
translations while preventing potential user misconceptions regarding the
minus symbol's intended functionality.

I also have doubts about whether the "-" symbol is appropriate for
representing empty values.
This was mentioned in my PR as well, and there was feedback suggesting
that "-" may not be suitable for conveying blank values when using a
screen reader.
However, I think this issue should be handled separately from this ticket,
and it probably requires a deeper discussion.
I’ll consider creating a discussion on this topic later.
Thank you for sharing your valuable thoughts!
--
Ticket URL: <https://code.djangoproject.com/ticket/36127#comment:23>
Reply all
Reply to author
Forward
0 new messages