Fix `TemplateDoesNotExist` when using `django-nested-admin` by returning custom template for other third-party packages. #341 (#342)
parent
ff0380977e
commit
6a7a230964
|
|
@ -74,6 +74,9 @@ def get_admin_interface_setting(setting):
|
|||
@register.simple_tag()
|
||||
def get_admin_interface_inline_template(template):
|
||||
template_path = template.split("/")
|
||||
if template_path[0] != "admin":
|
||||
# return costume inline template for other packages
|
||||
return template
|
||||
template_path[-1] = "headerless_" + template_path[-1]
|
||||
return "/".join(template_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ class AdminInterfaceTemplateTagsTestCase(TestCase):
|
|||
"admin/edit_inline/stacked.html"
|
||||
)
|
||||
self.assertEqual(headless_template, "admin/edit_inline/headerless_stacked.html")
|
||||
headless_template = templatetags.get_admin_interface_inline_template(
|
||||
"nesting/admin/inlines/tabular.html"
|
||||
)
|
||||
self.assertEqual(headless_template, "nesting/admin/inlines/tabular.html")
|
||||
|
||||
def test_get_active_date_hierarchy_none(self):
|
||||
changelist = Mock()
|
||||
|
|
|
|||
Loading…
Reference in New Issue