Skip to content

Issue #4: User Admin Improvements#6

Merged
andrewyager merged 6 commits intomainfrom
issue/4/impl
Feb 18, 2026
Merged

Issue #4: User Admin Improvements#6
andrewyager merged 6 commits intomainfrom
issue/4/impl

Conversation

@andrewyager
Copy link
Member

Implements #4

Summary

  • Restructure the CustomUser admin with django-unfold tabbed layout (Profile, Permissions, Activity tabs), enhanced list view with department column, expanded filters (including superuser and department), and department autocomplete
  • Add custom Group admin with UnfoldAdmin styling, user count annotations in the list view, and links to filtered user lists
  • Implement 7 bulk user management actions: assign/remove groups, set/clear staff status, set/clear superuser status (restricted to superusers with confirmation step), and assign department — all with intermediate forms or confirmation steps as appropriate
  • All bulk actions create Django LogEntry audit records for accountability

Test Coverage

  • 48 new tests added across 3 test classes:
    • TestCustomUserAdminLayout (24 tests): admin layout, list columns, filters, search, autocomplete
    • TestGroupAdminLayout (8 tests): UnfoldAdmin base, user count annotation, filtered user link
    • TestBulkUserActions (16 tests): each action's data modification, superuser-only restrictions, LogEntry audit records
  • Full suite: 1381 tests passing, 0 failures

Created by spec-pipeline

andrewyager and others added 4 commits February 18, 2026 20:57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restructure the CustomUser admin to use django-unfold tabbed layout
with Profile, Permissions, and Activity tabs per S2.13.5-04. Add
is_superuser and requested_department to list filters (S2.13.5-06),
requested_department autocomplete (S2.13.5-08), and department column
to list display (S2.13.5-05).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… link

Register custom Group admin with UnfoldAdmin base class per S2.13.5-09.
Annotate queryset with user count and display in list view. Add link to
filtered user changelist from each group row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement assign/remove groups, set/clear is_staff, set/clear
is_superuser, and assign department bulk actions on CustomUserAdmin
per S2.13.5-10. Superuser actions restricted to superusers with
confirmation step (S2.13.5-11). All actions create LogEntry audit
records (S2.13.5-12).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andrewyager
Copy link
Member Author

I think this PR misses the mark on the department management compared to the intent of the issue (and the spec). It's implemented for the "requested department" which is used during user creation/activation, but not actually the department (which is a m2m key from the Department model). Working on a fix for this now.

andrewyager and others added 2 commits February 18, 2026 23:13
The assign_department action was incorrectly setting the requested_department
FK instead of managing the Department.managers M2M relationship. This fixes
the MUST requirement S2.13.5-02 and adds a remove_from_department action.

- display_department now shows managed_departments (M2M) not requested_department
- assign_department adds users to Department.managers M2M
- Added remove_from_department bulk action with intermediate form
- Department list filter changed to managed_departments
- 3 new tests, all 1384 passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verification found that only 4 of 8 bulk actions had explicit
LogEntry audit tests. Adds tests for remove_groups, clear_is_staff,
clear_is_superuser, and assign_department to close the V15 gap.

All 8 bulk actions now have LogEntry audit coverage per S2.13.5-12.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andrewyager andrewyager marked this pull request as ready for review February 18, 2026 12:37
@andrewyager andrewyager mentioned this pull request Feb 18, 2026
3 tasks
@andrewyager andrewyager merged commit 862d887 into main Feb 18, 2026
3 checks passed
@andrewyager andrewyager deleted the issue/4/impl branch February 18, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments