定制后界面
在应用目录下找到admin.py并进行编辑
from django.contrib.admin import AdminSite
from .models import Question,Choiceclass PollsAdminSite(AdminSite):site_header="Admin-site-header"site_title="admin-site-title"index_title="admin-index-title"polls_admin_site=PollsAdminSite(name='polls_admin')
polls_admin_site.register(Question)
polls_admin_site.register(Choice)
定制admin登录和导航标题
site_header="Admin-site-header"
定制admin页面标签Title
site_title="admin-site-title"
定制admin索引标题
index_title="admin-index-title"
定制admin管理入口URL
编辑项目目录中的urls.py
导入应用的admin,例如应用名为polls
from polls.admin import polls_admin_site
添加地址,例如地址为pollsadmin
path("pollsadmin/", polls_admin_site.urls)
from django.contrib import admin
from polls.admin import polls_admin_site
from django.urls import path,includeurlpatterns = [path("polls/",include("polls.urls")),path("pollsadmin/", polls_admin_site.urls),path("admin/", admin.site.urls),]