improve admin

This commit is contained in:
imperosol 2024-12-02 19:53:24 +01:00
parent 0342eb8214
commit 0ce73db818
2 changed files with 20 additions and 0 deletions

View File

@ -20,6 +20,17 @@ from club.models import Club, Membership
@admin.register(Club) @admin.register(Club)
class ClubAdmin(admin.ModelAdmin): class ClubAdmin(admin.ModelAdmin):
list_display = ("name", "unix_name", "parent", "is_active") list_display = ("name", "unix_name", "parent", "is_active")
search_fields = ("name", "unix_name")
autocomplete_fields = (
"parent",
"board_group",
"members_group",
"view_groups",
"edit_groups",
"owner_group",
"home",
"page",
)
@admin.register(Membership) @admin.register(Membership)

View File

@ -15,6 +15,7 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.models import Group as AuthGroup from django.contrib.auth.models import Group as AuthGroup
from django.contrib.auth.models import Permission
from core.models import Group, OperationLog, Page, SithFile, User from core.models import Group, OperationLog, Page, SithFile, User
@ -26,6 +27,7 @@ class GroupAdmin(admin.ModelAdmin):
list_display = ("name", "description", "is_manually_manageable") list_display = ("name", "description", "is_manually_manageable")
list_filter = ("is_manually_manageable",) list_filter = ("is_manually_manageable",)
search_fields = ("name",) search_fields = ("name",)
autocomplete_fields = ("permissions",)
@admin.register(User) @admin.register(User)
@ -37,10 +39,17 @@ class UserAdmin(admin.ModelAdmin):
"profile_pict", "profile_pict",
"avatar_pict", "avatar_pict",
"scrub_pict", "scrub_pict",
"user_permissions",
"groups",
) )
search_fields = ["first_name", "last_name", "username"] search_fields = ["first_name", "last_name", "username"]
@admin.register(Permission)
class PermissionAdmin(admin.ModelAdmin):
search_fields = ("codename",)
@admin.register(Page) @admin.register(Page)
class PageAdmin(admin.ModelAdmin): class PageAdmin(admin.ModelAdmin):
list_display = ("name", "_full_name", "owner_group") list_display = ("name", "_full_name", "owner_group")