定制后界面
在应用目录下找到admin.py并进行编辑
from django.contrib.admin import AdminSite
from .models import Question,Choice
class 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)
site_header="Admin-site-header"
site_title="admin-site-title"
index_title="admin-index-title"
编辑项目目录中的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,include
urlpatterns = [
path("polls/",include("polls.urls")),
path("pollsadmin/", polls_admin_site.urls),
path("admin/", admin.site.urls),
]