Skip to content

Commit e92d1e3

Browse files
nileshpaharijacobtylerwalls
authored andcommitted
Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.
Removed flex-wrap from .changelist-form-container and added min-width to the main content container to ensure proper layout behavior. Regression in 6ea3319.
1 parent c3c9f19 commit e92d1e3

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

django/contrib/admin/static/admin/css/changelists.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#changelist .changelist-form-container {
44
display: flex;
5-
flex-wrap: wrap;
65
align-items: flex-start;
76
width: 100%;
87
}
@@ -16,6 +15,7 @@
1615
}
1716

1817
#changelist .changelist-form-container:has(#changelist-filter) > div {
18+
min-width: 0;
1919
max-width: calc(100% - 270px);
2020
}
2121

docs/releases/6.0.2.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ Django 6.0.2 fixes several bugs in 6.0.1.
99
Bugfixes
1010
========
1111

12-
* ...
12+
* Fixed a visual regression in Django 6.0 that caused the admin filter sidebar
13+
to wrap below the changelist when filter elements contained long text
14+
(:ticket:`36850`).
15+

tests/admin_views/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,13 @@ class Person(models.Model):
266266
(2, "Female"),
267267
)
268268
name = models.CharField(max_length=100)
269-
gender = models.IntegerField(choices=GENDER_CHOICES)
269+
gender = models.IntegerField(
270+
choices=GENDER_CHOICES,
271+
verbose_name=(
272+
"very very very very very very very very very "
273+
"loooooooooooooooooooooooooooooooooooooooooong name"
274+
),
275+
)
270276
age = models.IntegerField(default=21)
271277
alive = models.BooleanField(default=True)
272278

tests/admin_views/tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7205,6 +7205,21 @@ def test_pagination_layout(self):
72057205
self.assertTrue(show_all.is_displayed())
72067206
self.take_screenshot("pagination")
72077207

7208+
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
7209+
def test_changelist_filter_sidebar_with_long_verbose_fields(self):
7210+
from selenium.webdriver.common.by import By
7211+
7212+
self.admin_login(
7213+
username="super", password="secret", login_url=reverse("admin:index")
7214+
)
7215+
Person.objects.create(name="John", gender=1)
7216+
self.selenium.get(
7217+
self.live_server_url + reverse("admin:admin_views_person_changelist")
7218+
)
7219+
changelist_filter = self.selenium.find_element(By.ID, "changelist-filter")
7220+
self.assertTrue(changelist_filter.is_displayed())
7221+
self.take_screenshot("filter_sidebar")
7222+
72087223

72097224
@override_settings(ROOT_URLCONF="admin_views.urls")
72107225
class ReadonlyTest(AdminFieldExtractionMixin, TestCase):

0 commit comments

Comments
 (0)