2021-10-25 12:28:05 +00:00
|
|
|
"""custom admin classes"""
|
2021-09-05 17:10:14 +00:00
|
|
|
|
2021-10-25 12:28:05 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
|
|
|
|
|
|
from .models import Account
|
|
|
|
|
|
|
|
|
|
|
|
class HomeAdmin(BaseUserAdmin):
|
|
|
|
"""register in admin page"""
|
|
|
|
|
|
|
|
list_display = ("name", "is_staff", "is_superuser")
|
|
|
|
list_filter = ("is_superuser",)
|
|
|
|
|
|
|
|
fieldsets = (
|
|
|
|
(None, {"fields": ("is_staff", "is_superuser", "password")}),
|
|
|
|
("Personal info", {"fields": ("name",)}),
|
|
|
|
("Groups", {"fields": ("groups",)}),
|
|
|
|
("Permissions", {"fields": ("user_permissions",)}),
|
|
|
|
)
|
|
|
|
add_fieldsets = (
|
|
|
|
(
|
|
|
|
None,
|
|
|
|
{"fields": ("is_staff", "is_superuser", "password1", "password2")},
|
|
|
|
),
|
|
|
|
("Personal info", {"fields": ("name",)}),
|
|
|
|
("Groups", {"fields": ("groups",)}),
|
|
|
|
("Permissions", {"fields": ("user_permissions",)}),
|
|
|
|
)
|
|
|
|
|
|
|
|
search_fields = ("name",)
|
|
|
|
ordering = ("name",)
|
|
|
|
filter_horizontal = ()
|
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(Account, HomeAdmin)
|