13、Django Admin创建两个独立的管理站点
admin文件
from .models import Epic, Event, EventHero, EventVillain
from django.contrib.admin import AdminSite
class EventAdminSite(AdminSite):
site_header = "Events管理"
site_title = "欢迎您!"
index_title = "管理员"
event_admin_site = EventAdminSite(name='event_admin')
event_admin_site.register(Epic)
event_admin_site.register(Event)
event_admin_site.register(EventHero)
event_admin_site.register(EventVillain)
urls
from django.contrib import admin
from django.urls import path
from Events.admin import event_admin_site
urlpatterns = [
path('entity-admin/', admin.site.urls),
path('event-admin/', event_admin_site.urls),
]
显示效果: