edit users filter

This commit is contained in:
Rachid Mrad 2023-10-06 14:20:22 -04:00
parent cc0acdba94
commit 8424e20195
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF

View file

@ -141,12 +141,17 @@ class MyUserAdmin(BaseUserAdmin):
"group",
"status",
)
list_filter = (
"is_active",
"groups",
)
# Let's define First group
# (which should in theory be the ONLY group)
def group(self, obj):
if obj.groups.filter(name="full_access_group").exists():
return "Super User"
return "Full access"
elif obj.groups.filter(name="cisa_analysts_group").exists():
return "Analyst"
return ""