[3.2.x] Fixed #33083 -- Fixed selecting all items in the admin changelist when actions are both top and bottom.
Thanks Benjamin Locher for the report. Regression in 30e59705fc3e3e9e8370b965af794ad6173bf92b. Backport of b0ed619303d2fb723330ca9efa3acf23d49f1d19 from main
This commit is contained in:
parent
e235c7815a
commit
6760f4fa25
@ -36,7 +36,10 @@
|
||||
|
||||
function clearAcross(options) {
|
||||
reset(options);
|
||||
document.querySelector(options.acrossInput).value = 0;
|
||||
const acrossInputs = document.querySelectorAll(options.acrossInput);
|
||||
acrossInputs.forEach(function(acrossInput) {
|
||||
acrossInput.value = 0;
|
||||
});
|
||||
document.querySelector(options.actionContainer).classList.remove(options.selectedClass);
|
||||
}
|
||||
|
||||
@ -107,8 +110,10 @@
|
||||
document.querySelectorAll(options.acrossQuestions + " a").forEach(function(el) {
|
||||
el.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
const acrossInput = document.querySelector(options.acrossInput);
|
||||
acrossInput.value = 1;
|
||||
const acrossInputs = document.querySelectorAll(options.acrossInput);
|
||||
acrossInputs.forEach(function(acrossInput) {
|
||||
acrossInput.value = 1;
|
||||
});
|
||||
showClear(options);
|
||||
});
|
||||
});
|
||||
|
@ -11,3 +11,7 @@ Bugfixes
|
||||
|
||||
* Fixed a bug in Django 3.2 that caused incorrect links on read-only fields in
|
||||
admin (:ticket:`33077`).
|
||||
|
||||
* Fixed a regression in Django 3.2 that caused incorrect selection of items
|
||||
across all pages when actions were placed both on the top and bottom of the
|
||||
admin change-list view (:ticket:`33083`).
|
||||
|
@ -133,6 +133,7 @@ class NoListDisplayLinksParentAdmin(admin.ModelAdmin):
|
||||
list_display_links = None
|
||||
list_display = ['name']
|
||||
list_editable = ['name']
|
||||
actions_on_bottom = True
|
||||
|
||||
|
||||
site.register(Parent, NoListDisplayLinksParentAdmin)
|
||||
|
@ -1444,12 +1444,13 @@ class SeleniumTests(AdminSeleniumTestCase):
|
||||
question = self.selenium.find_element_by_css_selector('.actions > .question')
|
||||
clear = self.selenium.find_element_by_css_selector('.actions > .clear')
|
||||
select_all = self.selenium.find_element_by_id('action-toggle')
|
||||
select_across = self.selenium.find_element_by_name('select_across')
|
||||
select_across = self.selenium.find_elements_by_name('select_across')
|
||||
|
||||
self.assertIs(question.is_displayed(), False)
|
||||
self.assertIs(clear.is_displayed(), False)
|
||||
self.assertIs(select_all.get_property('checked'), False)
|
||||
self.assertEqual(select_across.get_property('value'), '0')
|
||||
for hidden_input in select_across:
|
||||
self.assertEqual(hidden_input.get_property('value'), '0')
|
||||
self.assertIs(selection_indicator.is_displayed(), True)
|
||||
self.assertEqual(selection_indicator.text, '0 of 100 selected')
|
||||
self.assertIs(select_all_indicator.is_displayed(), False)
|
||||
@ -1458,7 +1459,8 @@ class SeleniumTests(AdminSeleniumTestCase):
|
||||
self.assertIs(question.is_displayed(), True)
|
||||
self.assertIs(clear.is_displayed(), False)
|
||||
self.assertIs(select_all.get_property('checked'), True)
|
||||
self.assertEqual(select_across.get_property('value'), '0')
|
||||
for hidden_input in select_across:
|
||||
self.assertEqual(hidden_input.get_property('value'), '0')
|
||||
self.assertIs(selection_indicator.is_displayed(), True)
|
||||
self.assertEqual(selection_indicator.text, '100 of 100 selected')
|
||||
self.assertIs(select_all_indicator.is_displayed(), False)
|
||||
@ -1467,7 +1469,8 @@ class SeleniumTests(AdminSeleniumTestCase):
|
||||
self.assertIs(question.is_displayed(), False)
|
||||
self.assertIs(clear.is_displayed(), True)
|
||||
self.assertIs(select_all.get_property('checked'), True)
|
||||
self.assertEqual(select_across.get_property('value'), '1')
|
||||
for hidden_input in select_across:
|
||||
self.assertEqual(hidden_input.get_property('value'), '1')
|
||||
self.assertIs(selection_indicator.is_displayed(), False)
|
||||
self.assertIs(select_all_indicator.is_displayed(), True)
|
||||
|
||||
@ -1475,7 +1478,8 @@ class SeleniumTests(AdminSeleniumTestCase):
|
||||
self.assertIs(question.is_displayed(), False)
|
||||
self.assertIs(clear.is_displayed(), False)
|
||||
self.assertIs(select_all.get_property('checked'), False)
|
||||
self.assertEqual(select_across.get_property('value'), '0')
|
||||
for hidden_input in select_across:
|
||||
self.assertEqual(hidden_input.get_property('value'), '0')
|
||||
self.assertIs(selection_indicator.is_displayed(), True)
|
||||
self.assertEqual(selection_indicator.text, '0 of 100 selected')
|
||||
self.assertIs(select_all_indicator.is_displayed(), False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user