DocManagerBackend/docmanager_backend/accounts/admin.py
2024-11-23 21:55:32 +08:00

16 lines
458 B
Python

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",)}),)
admin.site.register(CustomUser, CustomUserAdmin)