Skip to content

Commit 729266c

Browse files
knyghtysarahboyce
authored andcommitted
Fixed #34982 -- Fixed admin's read-only password widget and help texts alignment for tablet screen size.
Co-authored-by: Sarah Boyce <[email protected]>
1 parent a652f07 commit 729266c

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

django/contrib/admin/static/admin/css/forms.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ form .form-row p {
2424

2525
.flex-container {
2626
display: flex;
27-
flex-wrap: wrap;
2827
}
2928

3029
.form-multiline > div {
@@ -78,6 +77,7 @@ form ul.inline li {
7877
.aligned label {
7978
display: block;
8079
padding: 4px 10px 0 0;
80+
min-width: 160px;
8181
width: 160px;
8282
word-wrap: break-word;
8383
line-height: 1;

django/contrib/admin/static/admin/css/responsive.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ input[type="submit"], button {
588588

589589
.aligned label {
590590
width: 100%;
591+
min-width: auto;
591592
padding: 0 0 10px;
592593
}
593594

django/contrib/admin/static/admin/css/widgets.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
padding: 0;
7070
overflow: hidden;
7171
line-height: 1;
72+
min-width: auto;
7273
}
7374

7475
.selector .selector-available input,

docs/releases/4.2.8.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ Bugfixes
3131
* Fixed a regression in Django 4.2 that caused a crash of querysets with
3232
aggregations on MariaDB when the ``ONLY_FULL_GROUP_BY`` SQL mode was enabled
3333
(:ticket:`34992`).
34+
35+
* Fixed a regression in Django 4.2 where the admin's read-only password widget
36+
and some help texts were incorrectly aligned at tablet widths
37+
(:ticket:`34982`).

tests/admin_views/tests.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5754,6 +5754,7 @@ def test_prepopulated_fields(self):
57545754
and with stacked and tabular inlines.
57555755
Refs #13068, #9264, #9983, #9784.
57565756
"""
5757+
from selenium.webdriver import ActionChains
57575758
from selenium.webdriver.common.by import By
57585759

57595760
self.admin_login(
@@ -5766,6 +5767,8 @@ def test_prepopulated_fields(self):
57665767

57675768
# Main form ----------------------------------------------------------
57685769
self.selenium.find_element(By.ID, "id_pubdate").send_keys("2012-02-18")
5770+
status = self.selenium.find_element(By.ID, "id_status")
5771+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
57695772
self.select_option("#id_status", "option two")
57705773
self.selenium.find_element(By.ID, "id_name").send_keys(
57715774
" the mAin nÀMë and it's awεšomeıııİ"
@@ -5784,6 +5787,10 @@ def test_prepopulated_fields(self):
57845787
self.selenium.find_element(
57855788
By.ID, "id_relatedprepopulated_set-0-pubdate"
57865789
).send_keys("2011-12-17")
5790+
status = self.selenium.find_element(
5791+
By.ID, "id_relatedprepopulated_set-0-status"
5792+
)
5793+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
57875794
self.select_option("#id_relatedprepopulated_set-0-status", "option one")
57885795
self.selenium.find_element(
57895796
By.ID, "id_relatedprepopulated_set-0-name"
@@ -5815,6 +5822,10 @@ def test_prepopulated_fields(self):
58155822
self.selenium.find_element(
58165823
By.ID, "id_relatedprepopulated_set-1-pubdate"
58175824
).send_keys("1999-01-25")
5825+
status = self.selenium.find_element(
5826+
By.ID, "id_relatedprepopulated_set-1-status"
5827+
)
5828+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
58185829
self.select_option("#id_relatedprepopulated_set-1-status", "option two")
58195830
self.selenium.find_element(
58205831
By.ID, "id_relatedprepopulated_set-1-name"
@@ -5838,10 +5849,10 @@ def test_prepopulated_fields(self):
58385849

58395850
# Tabular inlines ----------------------------------------------------
58405851
# Initial inline
5841-
element = self.selenium.find_element(
5852+
status = self.selenium.find_element(
58425853
By.ID, "id_relatedprepopulated_set-2-0-status"
58435854
)
5844-
self.selenium.execute_script("window.scrollTo(0, %s);" % element.location["y"])
5855+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
58455856
self.selenium.find_element(
58465857
By.ID, "id_relatedprepopulated_set-2-0-pubdate"
58475858
).send_keys("1234-12-07")
@@ -5872,6 +5883,10 @@ def test_prepopulated_fields(self):
58725883
self.selenium.find_element(
58735884
By.ID, "id_relatedprepopulated_set-2-1-pubdate"
58745885
).send_keys("1981-08-22")
5886+
status = self.selenium.find_element(
5887+
By.ID, "id_relatedprepopulated_set-2-1-status"
5888+
)
5889+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
58755890
self.select_option("#id_relatedprepopulated_set-2-1-status", "option one")
58765891
self.selenium.find_element(
58775892
By.ID, "id_relatedprepopulated_set-2-1-name"
@@ -5898,6 +5913,8 @@ def test_prepopulated_fields(self):
58985913
# Initial inline.
58995914
row_id = "id_relatedprepopulated_set-4-0-"
59005915
self.selenium.find_element(By.ID, f"{row_id}pubdate").send_keys("2011-12-12")
5916+
status = self.selenium.find_element(By.ID, f"{row_id}status")
5917+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
59015918
self.select_option(f"#{row_id}status", "option one")
59025919
self.selenium.find_element(By.ID, f"{row_id}name").send_keys(
59035920
" sŤāÇkeð inline ! "
@@ -5917,6 +5934,8 @@ def test_prepopulated_fields(self):
59175934
)[3].click()
59185935
row_id = "id_relatedprepopulated_set-4-1-"
59195936
self.selenium.find_element(By.ID, f"{row_id}pubdate").send_keys("1999-01-20")
5937+
status = self.selenium.find_element(By.ID, f"{row_id}status")
5938+
ActionChains(self.selenium).move_to_element(status).click(status).perform()
59205939
self.select_option(f"#{row_id}status", "option two")
59215940
self.selenium.find_element(By.ID, f"{row_id}name").send_keys(
59225941
" now you haVe anöther sŤāÇkeð inline with a very loooong "

0 commit comments

Comments
 (0)