DocManagerBackend/docmanager_backend/accounts/admin.py

18 lines
486 B
Python
Raw Normal View History

2024-11-23 21:55:32 +08:00
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser
class CustomUserAdmin(UserAdmin):
model = CustomUser
list_display = ("id", "full_name", "role", "is_active")
readonly_fields = ("date_joined",)
# Add this line to include the role field in the admin form
fieldsets = UserAdmin.fieldsets + \
((None, {"fields": ("role", "sex", "birthday")}),)
2024-11-23 21:55:32 +08:00
admin.site.register(CustomUser, CustomUserAdmin)