admin.py
from django.contrib import admin from app.models import Product # Register your models here. class MyAdminSite(admin.AdminSite): site_header = ‘我的管理网站‘ admin_site = MyAdminSite() #使用admin_site实例注册需要管理的模型类 admin_site.register(Product)
修改urls.py
from django.conf.urls import url, include from django.contrib import admin from app.admin import admin_site urlpatterns = [ url(r‘^admin/‘, admin_site.urls), #修改这一行 url(r‘^app/‘, include(‘app.urls‘)), ]
AdminSite中常用的定制属性:
site_header: 每个管理网页的页头都会出现的标题
site_title: 页面标题,<title></title>中的内容
site_url: 管理站点中View site的目标地址
login_form: 登录页面使用的AuthenticationForm子类名
原文:http://www.cnblogs.com/huangxm/p/6286299.html