Django - Admin - How to override change_list template for Model Proxy?

有些话、适合烂在心里 提交于 2019-12-05 19:22:22

Try lowercasing your folder names.

Note, that the admin app will lowercase the model name when looking for the directory, so make sure you name the directory in all lowercase if you are going to run your app on a case-sensitive filesystem.

Also, have you gone through the checklist of making sure your templates directory is working at all? TEMPLATE_DIRS needs to contain this templates folder of yours, and make sure the filesystem template loader comes before the app_directories loader.

Finally, you can point to a template via a ModelAdmin attribute: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_list_template

On top of lowercasing your paths to look like:

templates/admin/visitorlog/visitorexpectedtodayproxy/change_list.html

The content of your change_list.html should extend the default admin/change_list:

{% extends "admin/change_list.html" %}

You can customise the different section of this page by looking at the various block templates in the django source code:

django/contrib/admin/templates/admin/change_list.html
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!