from
future
import unicode_literals
from django.contrib import admin
from bookmodels.models import bookdb
Register your models here.
admin.site.register(bookdb)
admin.site.register([bookdb,bookinfo])
3、设置数据库中表要显示的字段admin.py
from django.contrib import admin
from blog import models
class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title', 'timestamp')
admin.site.register(models.BlogPost, BlogPostAdmin)
image.png
4、设置语言:settings.py
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
5、设置显示的字段、每页显示几行、排序、默认可编辑的页面、外键字段、点击可以编辑的字段:list_display,list_per_page,ordering,list_editable,fk_fields,list_display_links
from django.contrib import admin
from blog.models import Blog