Django Admin - change header 'Django administration' text

后端 未结 18 2349
眼角桃花
眼角桃花 2020-11-28 01:14

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.

18条回答
  •  忘掉有多难
    2020-11-28 01:32

    From Django 2.0 you can just add a single line in the url.py and change the name.

    # url.py
    
    from django.contrib import admin 
    admin.site.site_header = "My Admin Central" # Add this
    

    For older versions of Django. (<1.11 and earlier) you need to edit admin/base_site.html

    Change this line

    {% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
    

    to

    {% block title %}{{ title }} | {{ site_title|default:_('Your Site name Admin Central') }}{% endblock %}
    

    You can check your django version by

    django-admin --version
    

提交回复
热议问题