1.创建超级用户
python manage.py createsuperuser
2.登录admin界面
d.PNG3.在admin.py注册
from .models import Page
admin.site.register([User, Category, Page])
在并列路径下引用时,前面加 ‘.’
4.界面管理设置
// 字段以列表显示
class UserAdmin(admin.ModelAdmin):
list_display = ['username','password', 'profile', 'email']
// 设置内联
class PageInline(admin.TabularInline):
model = Page
extra = 1
class CategoryAdmin(admin.ModelAdmin):
list_display = ['course','slug']
inlines = [PageInline]
网友评论