1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #27888 -- Added link to clear all filters in the admin changelist view.

This commit is contained in:
Hasan Ramezani
2020-01-21 15:14:11 +01:00
committed by Mariusz Felisiak
parent 5a68a223c7
commit b94764e178
4 changed files with 26 additions and 0 deletions

View File

@@ -707,6 +707,18 @@ class ChangeListTests(TestCase):
link = reverse('admin:admin_changelist_parent_change', args=(p.pk,))
self.assertNotContains(response, '<a href="%s">' % link)
def test_clear_all_filters_link(self):
self.client.force_login(self.superuser)
link = '<a href="?">&#10006; Clear all filters</a>'
response = self.client.get(reverse('admin:auth_user_changelist'))
self.assertNotContains(response, link)
for data in (
{SEARCH_VAR: 'test'},
{'is_staff__exact': '0'},
):
response = self.client.get(reverse('admin:auth_user_changelist'), data=data)
self.assertContains(response, link)
def test_tuple_list_display(self):
swallow = Swallow.objects.create(origin='Africa', load='12.34', speed='22.2')
swallow2 = Swallow.objects.create(origin='Africa', load='12.34', speed='22.2')