mirror of
https://github.com/django/django.git
synced 2025-03-06 15:32:33 +00:00
[5.2.x] Fixed #36114 -- Fixed link visibility when list_display_links field contains only whitespace.
Backport of e262d5355d82901f81fba6c7015643c2b87125bf from main.
This commit is contained in:
parent
1df0f998ae
commit
5242220a56
@ -223,6 +223,8 @@ def items_for_result(cl, result, form):
|
||||
empty_value_display = getattr(
|
||||
attr, "empty_value_display", empty_value_display
|
||||
)
|
||||
if isinstance(value, str) and value.strip() == "":
|
||||
value = ""
|
||||
if f is None or f.auto_created:
|
||||
if field_name == "action_checkbox":
|
||||
row_classes = ["action-checkbox"]
|
||||
|
@ -1076,6 +1076,17 @@ class ChangeListTests(TestCase):
|
||||
"http://blues_history.com</a>" % g.pk,
|
||||
)
|
||||
|
||||
def test_blank_str_display_links(self):
|
||||
self.client.force_login(self.superuser)
|
||||
gc = GrandChild.objects.create(name=" ")
|
||||
response = self.client.get(
|
||||
reverse("admin:admin_changelist_grandchild_changelist")
|
||||
)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<a href="/admin/admin_changelist/grandchild/%s/change/">-</a>' % gc.pk,
|
||||
)
|
||||
|
||||
def test_clear_all_filters_link(self):
|
||||
self.client.force_login(self.superuser)
|
||||
url = reverse("admin:auth_user_changelist")
|
||||
|
Loading…
x
Reference in New Issue
Block a user