Fixed #28122 -- Fixed crash when overriding views.static.directory_index()'s template.

This commit is contained in:
Tim Graham 2017-04-25 11:01:21 -04:00 committed by GitHub
parent 84dcd16247
commit 56970c5b61
3 changed files with 21 additions and 1 deletions

View file

@ -112,6 +112,20 @@ class StaticTests(SimpleTestCase):
response = self.client.get('/%s/' % self.prefix)
self.assertContains(response, 'Index of ./')
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'loaders': [
('django.template.loaders.locmem.Loader', {
'static/directory_index.html': 'Test index',
}),
],
},
}])
def test_index_custom_template(self):
response = self.client.get('/%s/' % self.prefix)
self.assertEqual(response.content, b'Test index')
class StaticHelperTest(StaticTests):
"""