All checks were successful
Build And Test / build-and-push (push) Successful in 4m8s
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from .models import CustomUser
|
|
|
|
# admin.site.register(CustomUser)
|
|
class CustomUserAdmin(UserAdmin):
|
|
"""사용자 관리자 페이지 커스터마이징"""
|
|
model = CustomUser
|
|
list_display = ('username', 'email', 'is_staff', 'is_active')
|
|
list_filter = ('is_staff', 'is_active')
|
|
|
|
# 사용자 필드 구성
|
|
fieldsets = (
|
|
(None, {'fields': ('username', 'password')}),
|
|
('Personal Info', {
|
|
'fields': (
|
|
'email',
|
|
'encrypted_private_key',
|
|
'nhnc_id',
|
|
'nhnc_api_tenant_id',
|
|
'url_gitea',
|
|
'url_harbor',
|
|
'url_argocd',
|
|
'url_web_ide',
|
|
'url_rancher',
|
|
'url_grafana',
|
|
'url_prometheus',
|
|
'url_opensearch',
|
|
'url_kiali',
|
|
'url_nexus',
|
|
'url_mattermost',
|
|
)
|
|
}),
|
|
('Permissions', {'fields': ('is_staff', 'is_active')}),
|
|
)
|
|
|
|
# 읽기 전용 필드 추가
|
|
readonly_fields = ('encrypted_private_key',)
|
|
|
|
search_fields = ('username', 'email', 'nhnc_id', 'nhnc_api_tenant_id')
|
|
ordering = ('username',)
|
|
|
|
|
|
# 관리자 등록
|
|
admin.site.register(CustomUser, CustomUserAdmin) |