From 4047c1602ce5f0b569ae763aa533c5de78cfc0a9 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Thu, 8 Oct 2020 14:44:34 -0500 Subject: [PATCH] [3.1.x] Fixed #32091 -- Fixed admin search bar width on filtered admin page. Backport of b7da588e883e12b8ac3bb8a486e654e30fc1c6c8 from master --- django/contrib/admin/static/admin/css/responsive.css | 3 ++- docs/releases/3.1.3.txt | 3 +++ tests/admin_views/tests.py | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/static/admin/css/responsive.css b/django/contrib/admin/static/admin/css/responsive.css index d745eaebf37..d4f520b71f1 100644 --- a/django/contrib/admin/static/admin/css/responsive.css +++ b/django/contrib/admin/static/admin/css/responsive.css @@ -120,7 +120,8 @@ input[type="submit"], button { } #changelist-search .quiet { - width: 100%; + width: 0; + flex: 1 0 auto; margin: 5px 0 0 25px; } diff --git a/docs/releases/3.1.3.txt b/docs/releases/3.1.3.txt index e2bb2d0df3d..e0f543a5165 100644 --- a/docs/releases/3.1.3.txt +++ b/docs/releases/3.1.3.txt @@ -12,6 +12,9 @@ Bugfixes * Fixed a regression in Django 3.1.2 that caused the incorrect height of the admin changelist search bar (:ticket:`32072`). +* Fixed a regression in Django 3.1.2 that caused the incorrect width of the + admin changelist search bar on a filtered admin page (:ticket:`32091`). + * Fixed displaying Unicode characters in :class:`forms.JSONField ` and read-only :class:`models.JSONField ` values in the admin diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index a83c2daf8d1..115237d5140 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4813,6 +4813,17 @@ class SeleniumTests(AdminSeleniumTestCase): value = self.selenium.find_element_by_id('id_form-0-parent').get_attribute('value') self.assertEqual(value, str(parent2.pk)) + def test_search_input_filtered_page(self): + Person.objects.create(name='Guido van Rossum', gender=1, alive=True) + Person.objects.create(name='Grace Hopper', gender=1, alive=False) + self.admin_login(username='super', password='secret', login_url=reverse('admin:index')) + person_url = reverse('admin:admin_views_person_changelist') + '?q=Gui' + self.selenium.get(self.live_server_url + person_url) + self.assertGreater( + self.selenium.find_element_by_id('searchbar').rect['width'], + 50, + ) + @override_settings(ROOT_URLCONF='admin_views.urls') class ReadonlyTest(AdminFieldExtractionMixin, TestCase):