diff --git a/docs/django-admin/roles.md b/docs/django-admin/roles.md index 6a9f0ca75..0afe5db8b 100644 --- a/docs/django-admin/roles.md +++ b/docs/django-admin/roles.md @@ -7,6 +7,8 @@ Permissions on these roles are set through groups: groups and the methods to create them are defined in our `user_group` model and run in a migration. +For more details, refer to the [user group model](../../src/registrar/models/user_group.py). + ## Editing group permissions through code We can edit and deploy new group permissions by: diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 251dee63c..9b6feabca 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -192,6 +192,14 @@ class MyUserAdmin(BaseUserAdmin): ), ("Important dates", {"fields": ("last_login", "date_joined")}), ) + + analyst_list_display = [ + "email", + "first_name", + "last_name", + "group", + "status", + ] # NOT all fields are readonly for admin, otherwise we would have # set this at the permissions level. The exception is 'status' @@ -219,13 +227,7 @@ class MyUserAdmin(BaseUserAdmin): return super().get_list_display(request) # Customize the list display for analysts - return ( - "email", - "first_name", - "last_name", - "group", - "status", - ) + return self.analyst_list_display def get_fieldsets(self, request, obj=None): if request.user.has_perm("registrar.full_access_permission"): diff --git a/src/registrar/tests/test_migrations.py b/src/registrar/tests/test_migrations.py index 14228a491..f98e876d7 100644 --- a/src/registrar/tests/test_migrations.py +++ b/src/registrar/tests/test_migrations.py @@ -31,7 +31,7 @@ class TestGroups(TestCase): UserGroup.objects.filter(name="full_access_group"), [full_access_group] ) - # Test permissions for cisa_analysts)group + # Test permissions for cisa_analysts_group # Define the expected permission codenames expected_permissions = [ "view_logentry",