#用于admin页面填写字段完整性以及使密码有两次校验和密文效果
from django.contrib import admin
# Register your models here.
from . import models
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
class UserAdmin(AuthUserAdmin):
# 添加用户页面可控制字段
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('username', 'password1', 'password2', 'is_staff', 'mobile'),
}),
)
# 用户列表展示页面显示字段
list_display = ('username', 'email', 'mobile', 'is_staff')
# 注册自定义User表,用admin管理,配置UserAdmin,定制化管理页面
admin.site.register(models.User, UserAdmin)