如何更改Django admin标题中的"Django administration"文本?
在"自定义管理员"文档中似乎没有涉及到这一点.
如何更改Django admin标题中的"Django administration"文本?
在"自定义管理员"文档中似乎没有涉及到这一点.
Update:如果您使用的是Django 1.7+,请参阅answer below.
Original answer from 2011:
您需要创建自己的admin base_site.html
模板才能做到这一点.最简单的方法是创建文件:
/<projectdir>/templates/admin/base_site.html
这应该是original base_site.html
的副本,除了加入你的自定义标题:
{% block branding %}
<h1 id="site-name">{% trans 'my cool admin console' %}</h1>
{% endblock %}
要使其工作,您需要为您的项目设置正确的设置,即在settings.py
:
TEMPLATE_DIRS
中加入/projectdir/templates/
.TEMPLATE_LOADERS
中加入django.template.loaders.filesystem.Loader
.