Skip to content

Commit

Permalink
Perm fields har default value, kan overskrives ved superusesr
Browse files Browse the repository at this point in the history
  • Loading branch information
mhewel committed Sep 24, 2023
1 parent b92517d commit 30cdbbb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions members/admin/user_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")}),
Expand Down

0 comments on commit 30cdbbb

Please sign in to comment.