Skip to content

Commit

Permalink
[4.2.x] Fixed #34982 -- Fixed admin's read-only password widget and h…
Browse files Browse the repository at this point in the history
…elp texts alignment for tablet screen size.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>

Backport of 729266c from main
  • Loading branch information
knyghty authored and nessita committed Nov 27, 2023
1 parent cdb14cc commit bd0ea8c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion django/contrib/admin/static/admin/css/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ form .form-row p {

.flex-container {
display: flex;
flex-wrap: wrap;
}

.form-multiline > div {
Expand Down Expand Up @@ -78,6 +77,7 @@ form ul.inline li {
.aligned label {
display: block;
padding: 4px 10px 0 0;
min-width: 160px;
width: 160px;
word-wrap: break-word;
line-height: 1;
Expand Down
1 change: 1 addition & 0 deletions django/contrib/admin/static/admin/css/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ input[type="submit"], button {

.aligned label {
width: 100%;
min-width: auto;
padding: 0 0 10px;
}

Expand Down
1 change: 1 addition & 0 deletions django/contrib/admin/static/admin/css/widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
padding: 0;
overflow: hidden;
line-height: 1;
min-width: auto;
}

.selector .selector-available input,
Expand Down
4 changes: 4 additions & 0 deletions docs/releases/4.2.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ Bugfixes
* Fixed a regression in Django 4.2 that caused a crash of querysets with
aggregations on MariaDB when the ``ONLY_FULL_GROUP_BY`` SQL mode was enabled
(:ticket:`34992`).

* Fixed a regression in Django 4.2 where the admin's read-only password widget
and some help texts were incorrectly aligned at tablet widths
(:ticket:`34982`).
23 changes: 21 additions & 2 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5576,6 +5576,7 @@ def test_prepopulated_fields(self):
and with stacked and tabular inlines.
Refs #13068, #9264, #9983, #9784.
"""
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

self.admin_login(
Expand All @@ -5588,6 +5589,8 @@ def test_prepopulated_fields(self):

# Main form ----------------------------------------------------------
self.selenium.find_element(By.ID, "id_pubdate").send_keys("2012-02-18")
status = self.selenium.find_element(By.ID, "id_status")
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option("#id_status", "option two")
self.selenium.find_element(By.ID, "id_name").send_keys(
" the mAin nÀMë and it's awεšomeıııİ"
Expand All @@ -5606,6 +5609,10 @@ def test_prepopulated_fields(self):
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-0-pubdate"
).send_keys("2011-12-17")
status = self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-0-status"
)
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option("#id_relatedprepopulated_set-0-status", "option one")
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-0-name"
Expand Down Expand Up @@ -5637,6 +5644,10 @@ def test_prepopulated_fields(self):
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-1-pubdate"
).send_keys("1999-01-25")
status = self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-1-status"
)
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option("#id_relatedprepopulated_set-1-status", "option two")
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-1-name"
Expand All @@ -5660,10 +5671,10 @@ def test_prepopulated_fields(self):

# Tabular inlines ----------------------------------------------------
# Initial inline
element = self.selenium.find_element(
status = self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-0-status"
)
self.selenium.execute_script("window.scrollTo(0, %s);" % element.location["y"])
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-0-pubdate"
).send_keys("1234-12-07")
Expand Down Expand Up @@ -5694,6 +5705,10 @@ def test_prepopulated_fields(self):
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-1-pubdate"
).send_keys("1981-08-22")
status = self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-1-status"
)
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option("#id_relatedprepopulated_set-2-1-status", "option one")
self.selenium.find_element(
By.ID, "id_relatedprepopulated_set-2-1-name"
Expand All @@ -5720,6 +5735,8 @@ def test_prepopulated_fields(self):
# Initial inline.
row_id = "id_relatedprepopulated_set-4-0-"
self.selenium.find_element(By.ID, f"{row_id}pubdate").send_keys("2011-12-12")
status = self.selenium.find_element(By.ID, f"{row_id}status")
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option(f"#{row_id}status", "option one")
self.selenium.find_element(By.ID, f"{row_id}name").send_keys(
" sŤāÇkeð inline ! "
Expand All @@ -5739,6 +5756,8 @@ def test_prepopulated_fields(self):
)[3].click()
row_id = "id_relatedprepopulated_set-4-1-"
self.selenium.find_element(By.ID, f"{row_id}pubdate").send_keys("1999-01-20")
status = self.selenium.find_element(By.ID, f"{row_id}status")
ActionChains(self.selenium).move_to_element(status).click(status).perform()
self.select_option(f"#{row_id}status", "option two")
self.selenium.find_element(By.ID, f"{row_id}name").send_keys(
" now you haVe anöther sŤāÇkeð inline with a very loooong "
Expand Down

0 comments on commit bd0ea8c

Please sign in to comment.