Django 覆盖自定义管理站点的模板

Django override custom admin site's templates

我的 Django 应用程序中有两个管理站点。一个名为 admin,另一个名为 owneradmin。 我想分别覆盖他们的模板。有办法吗?

如果要覆盖索引模板,最简单的方法是为AdminSite设置index_template

CustomAdminSite.index_template = 'path/to/custom/template.html'

OwnerAdminSite.index_template = 'path/to/owner/template.html'

有关索引模板和模板覆盖的更多详细信息,请参阅django docs