DJANGO解决扩展用户表时,后台ADMIN显示密码为明文的问题
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext_lazy
from teacher.models import UserProfile
@admin.register(UserProfile)
class UserProfileAdmin(UserAdmin):
list_display = ['username', 'password']
list_per_page = 10
add_fieldsets = (
(None, {u'fields': ('username', 'password1', 'password2')}),
(gettext_lazy('User Information'), {'fields': ('TE_id', 'gender', 'phone', 'email')}),
)