From 30cdbbb86f1a7be7796a75ac6f102c1490e9c45b Mon Sep 17 00:00:00 2001 From: mhewel <58829786+mhewel@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:33:24 +0200 Subject: [PATCH] Perm fields har default value, kan overskrives ved superusesr --- members/admin/user_admin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/members/admin/user_admin.py b/members/admin/user_admin.py index beca59a8..56a788ae 100644 --- a/members/admin/user_admin.py +++ b/members/admin/user_admin.py @@ -147,6 +147,8 @@ def get_fieldsets(self, request, obj=None): if not obj: return self.add_fieldsets + perm_fields = ("is_active", "is_staff", "groups") + if request.user.is_superuser: perm_fields = ( "is_active", @@ -155,10 +157,6 @@ def get_fieldsets(self, request, obj=None): "groups", "user_permissions", ) - else: - # modify these to suit the fields you want your - # staff user to be able to edit - perm_fields = ("is_active", "is_staff", "groups") return [ (None, {"fields": ("username", "password")}),