姜戈 1.6.11
应用程序结构如下所示:
my_project/
|-- new_app/
|-- templates/
在我的配置中:
TEMPLATE_ROOT = os.path.join(BASE_ROOT, 'templates/')
TEMPLATE_DIRS = (
TEMPLATE_ROOT,
)
INSTALLED_APPS = (
'django.contrib.admin',
...
'new_app',
)
我也尝试过列出new_app
before contrib.admin
但这没有帮助。
当我复制时venv/django/contrib/admin/templates/admin/change_list.html
to my /templates/admin/new_app/change_list.html
我没有看到我的自定义显示。
my_project/
|-- new_app/
|-- templates/
|-- admin/
|-- new_app/
|-- change_list.html
当我将 change_list.html 上移一级使其位于管理路径下时,更改会正常显示:
my_project/
|-- new_app/
|-- templates/
|-- admin/
|-- change_list.html
|-- new_app/ (now an empty folder)
...但是当然,这意味着我的更改将影响每个管理页面,而不仅仅是我要修改的应用程序。
我已将其添加到 admin.py 中应用程序的唯一模型中:
class MyModelAdmin(reversion.VersionAdmin):
change_list_template = 'admin/new_app/change_list.html'
...这给了我一些我需要的东西,但我还需要change_list_results.html,并且没有 ModelAdmin 覆盖。
我正在遵循位于以下位置的文档指南阅读文档 https://media.readthedocs.org/pdf/django/1.6.x/django.pdf在第 31 页的 2.4.8 节中,但我似乎没有任何运气。