激活管理界面:
1、给需要管理的数据表模块添加admin配置
方式:
新建一个 admin.py
Code:
from django.contrib import admin
from models import Publisher,Author,Book
admin.site.register(Publisher)
admin.site.register(Author)
admin.site.register(Book)
2、新增配置信息
#1.0新增 admin 时遇到
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
)
修改INSTALLED_APPS
#添加模型位置
INSTALLED_APPS = (
#'django.contrib.auth',
#'django.contrib.contenttypes',
#'django.contrib.sessions',
#'django.contrib.sites',
'mysite.books',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
3、urls.py 新增:
from django.contrib import admin
admin.autodiscover()
(r'^admin/(.*)', admin.site.root),
关于admin界面的汉化其实很简单,在setting.py里将LANGUAGE_CODE从en-us改为zh-CN
1、给需要管理的数据表模块添加admin配置
方式:
新建一个 admin.py
Code:
from django.contrib import admin
from models import Publisher,Author,Book
admin.site.register(Publisher)
admin.site.register(Author)
admin.site.register(Book)
2、新增配置信息
#1.0新增 admin 时遇到
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
)
修改INSTALLED_APPS
#添加模型位置
INSTALLED_APPS = (
#'django.contrib.auth',
#'django.contrib.contenttypes',
#'django.contrib.sessions',
#'django.contrib.sites',
'mysite.books',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
)
3、urls.py 新增:
from django.contrib import admin
admin.autodiscover()
(r'^admin/(.*)', admin.site.root),
关于admin界面的汉化其实很简单,在setting.py里将LANGUAGE_CODE从en-us改为zh-CN