Django管理员 - 更改标题'Django管理'文本 [英] Django Admin - change header 'Django administration' text

查看:203
本文介绍了Django管理员 - 更改标题'Django管理'文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改django管理员标题中的Django管理文本?

How does one change the 'Django administration' text in the django admin header?

自定义管理文档中似乎没有涵盖

It doesn't seem to be covered in the "Customizing the admin" documentation.

推荐答案

您需要创建自己的admin base_site.html模板才能执行此操作。最简单的方法是创建文件:

You need to create your own admin base_site.html template to do this. The easiest way is to create the file:

/<projectdir>/templates/admin/base_site.html

这应该是 https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html - 除了放置您的自定义标题:

This should be a copy of https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html - except putting in your custom title:

{% block branding %}
<h1 id="site-name">{% trans 'my cool admin console' %}</h1>
{% endblock %}

为此,您需要具有正确的设置对于您的项目,即在settings.py中:

For this to work, you need to have the correct settings for your project, namely in settings.py:


  • 确保将/ projectdir / templates /添加到TEMPLATE_DIRS

  • 确保将django.template.loaders.filesystem.Loader添加到TEMPLATE_LOADERS

请参阅 http://docs.djangoproject.com/en/dev/ref/settings/ 了解有关设置的更多信息。 py

See http://docs.djangoproject.com/en/dev/ref/settings/ for more information on settings.py

这篇关于Django管理员 - 更改标题'Django管理'文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆