mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
Fixed #32543 -- Added search_help_text to ModelAdmin.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b46dbd4e3e
commit
1143f3bb5e
@@ -1328,6 +1328,22 @@ class ChangeListTests(TestCase):
|
||||
# The "Add" button inside the object-tools shouldn't appear.
|
||||
self.assertNotIn('Add ', response.rendered_content)
|
||||
|
||||
def test_search_help_text(self):
|
||||
superuser = self._create_superuser('superuser')
|
||||
m = BandAdmin(Band, custom_site)
|
||||
# search_fields without search_help_text.
|
||||
m.search_fields = ['name']
|
||||
request = self._mocked_authenticated_request('/band/', superuser)
|
||||
response = m.changelist_view(request)
|
||||
self.assertIsNone(response.context_data['cl'].search_help_text)
|
||||
self.assertNotContains(response, '<div class="help">')
|
||||
# search_fields with search_help_text.
|
||||
m.search_help_text = 'Search help text'
|
||||
request = self._mocked_authenticated_request('/band/', superuser)
|
||||
response = m.changelist_view(request)
|
||||
self.assertEqual(response.context_data['cl'].search_help_text, 'Search help text')
|
||||
self.assertContains(response, '<div class="help">Search help text</div>')
|
||||
|
||||
|
||||
class GetAdminLogTests(TestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user