美文网首页
2021-02-04 Django 继承 AbstractUs

2021-02-04 Django 继承 AbstractUs

作者: 多吃水果少吃肉 | 来源:发表于2021-02-04 17:13 被阅读0次
    • 密码可更改
    • 手动设置修改项
    from django.contrib import admin
    from django.contrib.auth.admin import UserAdmin
    from django.utils.translation import gettext_lazy
    from account.models import User, Gender, Grade, Province, Company
    
    
    class UserInfoAdmin(UserAdmin):
        list_display = ('username', 'email', 'nickname')
        filter_horizontal = ('groups', 'user_permissions')
        fieldsets = (
            (None, {'fields': ('username', 'nickname', 'mobile', 'email', 'grade_name', 'password')}),
            (gettext_lazy('用户信息'), {'fields': ('gender', 'icon', 'province',
                                               'company_name', 'title', 'contact', 'section',
                                               'is_adult_hospital', 'is_signed', 'can_ocr', 'trans_union')}),
            (gettext_lazy('Permissions'), {'fields': ('is_superuser', 'is_staff', 'is_active',
                                                      'groups', 'user_permissions')}),
            # (gettext_lazy('Important dates'), {'fields': ('last_login', 'date_joined')}),
        )
    
    admin.site.register(User, UserInfoAdmin)
    

    相关文章

      网友评论

          本文标题:2021-02-04 Django 继承 AbstractUs

          本文链接:https://www.haomeiwen.com/subject/xfnbtltx.html