<gh_stars>0
from django.contrib.admin import AdminSite
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import User
from .forms import (UserCreationForm, UserChangeForm)

class IdofrontAdminSite(AdminSite):
    site_header = 'Idofront Archive Admin Site'
    site_title = 'Idofront Archive'
    index_title = 'Admin Site'
    logout_template = 'admin/login.html'

class UserAdmin(BaseUserAdmin):
    form = UserChangeForm
    add_form = UserCreationForm

    list_display = ('username', 'email', 'is_active', 'last_login')
    list_filter = ('is_active', 'is_superuser', 'last_login', 'user_permissions',)
    fieldsets = (
        (None, {'fields': ('username', 'password', 'date_joined', 'last_login')}),
        ('Email Address', {'fields': ('email',)}),
        ('Permissions', {'fields': ('user_permissions', 'is_superuser',)}),
        ('Account Status', {'fields': ('is_active',)})
    )
    add_fieldsets = (
        (None, {
            'classes': ('wide',),
            'fields': ('username', 'email', 'password', 'password_confirm'),
        }),
    )
    readonly_fields = ('date_joined', 'last_login')
    search_fields = ('username', 'email')
    ordering = ('username',)
    filter_horizontal = ()
    
    
admin_site = IdofrontAdminSite(name='adminsite')
admin_site.register(User, UserAdmin)
from django.contrib.admin import AdminSite
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import User
from .forms import (UserCreationForm, UserChangeForm)

class IdofrontAdminSite(AdminSite):
    site_header = 'Idofront Archive Admin Site'
    site_title = 'Idofront Archive'
    index_title = 'Admin Site'
    logout_template = 'admin/login.html'

class UserAdmin(BaseUserAdmin):
    form = UserChangeForm
    add_form = UserCreationForm

    list_display = ('username', 'email', 'is_active', 'last_login')
    list_filter = ('is_active', 'is_superuser', 'last_login', 'user_permissions',)
    fieldsets = (
        (None, {'fields': ('username', 'password', 'date_joined', 'last_login')}),
        ('Email Address', {'fields': ('email',)}),
        ('Permissions', {'fields': ('user_permissions', 'is_superuser',)}),
        ('Account Status', {'fields': ('is_active',)})
    )
    add_fieldsets = (
        (None, {
            'classes': ('wide',),
            'fields': ('username', 'email', 'password', 'password_confirm'),
        }),
    )
    readonly_fields = ('date_joined', 'last_login')
    search_fields = ('username', 'email')
    ordering = ('username',)
    filter_horizontal = ()
    
    
admin_site = IdofrontAdminSite(name='adminsite')
admin_site.register(User, UserAdmin)