2017-12-27 21:11:20 +00:00
|
|
|
from django.contrib import admin
|
2020-01-21 17:20:40 +00:00
|
|
|
from django.contrib.auth.admin import UserAdmin
|
2020-01-21 18:20:07 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2017-12-27 21:11:20 +00:00
|
|
|
|
2020-01-21 17:20:40 +00:00
|
|
|
# from authtools.admin import UserAdmin
|
|
|
|
from .forms import RadioUserChangeForm, RadioUserCreationForm
|
2017-12-27 21:11:20 +00:00
|
|
|
from .models import RadioUser
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(RadioUser)
|
|
|
|
class RadioUserAdmin(UserAdmin):
|
2020-01-21 17:20:40 +00:00
|
|
|
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')
|