Fixed #33156 -- Used sessionStorage to preserve quick filter for admin's navigation sidebar.
This commit is contained in:
parent
47f791f132
commit
1c802ca2a9
|
@ -74,7 +74,7 @@
|
|||
} else {
|
||||
event.target.classList.add('no-results');
|
||||
}
|
||||
localStorage.setItem('django.admin.navSidebarFilterValue', filterValue);
|
||||
sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue);
|
||||
}
|
||||
|
||||
const nav = document.getElementById('nav-filter');
|
||||
|
@ -82,7 +82,7 @@
|
|||
nav.addEventListener('input', checkValue, false);
|
||||
nav.addEventListener('keyup', checkValue, false);
|
||||
|
||||
const storedValue = localStorage.getItem('django.admin.navSidebarFilterValue');
|
||||
const storedValue = sessionStorage.getItem('django.admin.navSidebarFilterValue');
|
||||
if (storedValue) {
|
||||
nav.value = storedValue;
|
||||
checkValue({target: nav, key: ''});
|
||||
|
|
|
@ -167,7 +167,7 @@ class SeleniumTests(AdminSeleniumTestCase):
|
|||
reverse('test_with_sidebar:auth_user_changelist')
|
||||
)
|
||||
filter_value_script = (
|
||||
"return localStorage.getItem('django.admin.navSidebarFilterValue')"
|
||||
"return sessionStorage.getItem('django.admin.navSidebarFilterValue')"
|
||||
)
|
||||
self.assertIsNone(self.selenium.execute_script(filter_value_script))
|
||||
filter_input = self.selenium.find_element_by_css_selector('#nav-filter')
|
||||
|
|
Loading…
Reference in New Issue