一、注册到admin
1.应用admin.py中导入应用模型类
from django.contrib import admin
from apps.word.models import Word
2.注册模型类
admin.site.register(Word)
二、admin增强
1.创建admin配置类注册
class UserAdmin(admin.ModelAdmin):
pass
admin.site.register(User.UserAdmin)
2.admin配置类增强显示
class UserAdmin(admin.ModelAdmin):
list_display = ('id','username')
admin.site.register(User.UserAdmin)
更多查看文档
3.admin配置类过滤器
class UserAdmin(admin.ModelAdmin):
list_filter = ('last_login')
admin.site.register(User.UserAdmin)