41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
# from authtools.admin import UserAdmin
|
|
from .forms import RadioUserChangeForm, RadioUserCreationForm
|
|
from .models import RadioUser
|
|
|
|
|
|
@admin.register(RadioUser)
|
|
class RadioUserAdmin(UserAdmin):
|
|
add_form = RadioUserCreationForm
|
|
form = RadioUserChangeForm
|
|
model = RadioUser
|
|
|
|
list_display = ('is_active', 'email', 'name', 'is_superuser', 'is_staff',)
|
|
list_display_links = ('email', 'name',)
|
|
list_filter = ('is_superuser', 'is_staff', 'is_active',)
|
|
fieldsets = (
|
|
(None, {
|
|
'fields': ('email', 'name', 'password', 'is_dj',),
|
|
}),
|
|
(_('Permissions'), {
|
|
'fields': ('is_active', 'is_staff', 'is_superuser',
|
|
'groups', 'user_permissions',),
|
|
}),
|
|
(_('Important dates'), {
|
|
'fields': ('last_login', 'date_joined',),
|
|
}),
|
|
)
|
|
add_fieldsets = (
|
|
(None, {
|
|
'classes': ('wide',),
|
|
'fields': ('email', 'name', 'password1', 'password2',
|
|
'is_staff', 'is_active', 'is_superuser',),
|
|
}),
|
|
)
|
|
search_fields = ('email', 'name',)
|
|
ordering = None
|
|
filter_horizontal = ('groups', 'user_permissions',)
|
|
readonly_fields = ('last_login', 'date_joined')
|