pythonジャンゴ・22.adminホームテスト開発および変更タイトル

序文

「Djangoの管理」デフォルトで表示Djangoの管理ホームページは、タイトルが「Djangoのサイト管理者」を示し、ここにコンテンツをコピーし、自分のプロジェクトの背景にページの内容を変更することができます

ホームタイトル

背景には、以下の二つの場所を変更し、対応するプログラムをコピーするように変更され、ホームページを開くジャンゴ

admin.py変更

SITE_TITLE、site_header以下AdminSiteクラス内部sites.pyソース、3つの値がindex_title

class AdminSite:
    """
    An AdminSite object encapsulates an instance of the Django admin application, ready
    to be hooked in to your URLconf. Models are registered with the AdminSite using the
    register() method, and the get_urls() method can then be used to access Django view
    functions that present a full admin interface for the collection of registered
    models.
    """

    # Text to put at the end of each page's <title>. site_title = gettext_lazy('Django site admin') # Text to put in each page's <h1>. site_header = gettext_lazy('Django administration') # Text to put at the top of the admin index page. index_title = gettext_lazy('Site administration') # URL for the "View site" link at the top of each admin page. site_url = '/'

Admin.siteオーバーライドはadmin.pyで内部の属性値

  • ページのsite_headerセット内容
  • ページの左上隅SITE_TITLEタイトルコンテンツ
  • index_title管理
# admin.py
admin.site.site_header = 'xx 项目管理系统'
admin.site.site_title = '登录系统后台'
admin.site.index_title = '后台管理'

ページを更新し、あなたが変更されたコンテンツを見ることができます

あなたが見ることができるindex_title内容は、ログイン成功後に変更されました

おすすめ

転載: www.cnblogs.com/mashuqi/p/10984746.html
おすすめ