DRF_Template/backend/accounts/admin.py

17 lines
421 B
Python
Raw Normal View History

2024-01-06 12:13:39 +08:00
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser
class CustomUserAdmin(UserAdmin):
model = CustomUser
list_display = ('id',) + UserAdmin.list_display
# Editable fields per instance
fieldsets = UserAdmin.fieldsets + (
(None, {'fields': ('avatar',)}),
)
admin.site.register(CustomUser, CustomUserAdmin)