From 0ce73db8189f065419b87c4d6d648d4a31a6b774 Mon Sep 17 00:00:00 2001 From: imperosol Date: Mon, 2 Dec 2024 19:53:24 +0100 Subject: [PATCH] improve admin --- club/admin.py | 11 +++++++++++ core/admin.py | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/club/admin.py b/club/admin.py index c2444c17..2515e208 100644 --- a/club/admin.py +++ b/club/admin.py @@ -20,6 +20,17 @@ from club.models import Club, Membership @admin.register(Club) class ClubAdmin(admin.ModelAdmin): 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) diff --git a/core/admin.py b/core/admin.py index 30da472a..601ba636 100644 --- a/core/admin.py +++ b/core/admin.py @@ -15,6 +15,7 @@ from django.contrib import admin 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 @@ -26,6 +27,7 @@ class GroupAdmin(admin.ModelAdmin): list_display = ("name", "description", "is_manually_manageable") list_filter = ("is_manually_manageable",) search_fields = ("name",) + autocomplete_fields = ("permissions",) @admin.register(User) @@ -37,10 +39,17 @@ class UserAdmin(admin.ModelAdmin): "profile_pict", "avatar_pict", "scrub_pict", + "user_permissions", + "groups", ) search_fields = ["first_name", "last_name", "username"] +@admin.register(Permission) +class PermissionAdmin(admin.ModelAdmin): + search_fields = ("codename",) + + @admin.register(Page) class PageAdmin(admin.ModelAdmin): list_display = ("name", "_full_name", "owner_group")