| """ |
| Admin configuration for the audit/compliance app. |
| """ |
| from django.contrib import admin |
|
|
| from apps.audit.models import ( |
| ConsentRecord, |
| DataExport, |
| Deletion, |
| OrgDeletionLock, |
| PIIAccessLog, |
| UserDeletionLock, |
| ) |
|
|
|
|
| @admin.register(ConsentRecord) |
| class ConsentRecordAdmin(admin.ModelAdmin): |
| list_display = ("user", "terms_version_id", "ip_address", "accepted_at") |
| list_filter = ("terms_version_id",) |
| search_fields = ("user__email",) |
| readonly_fields = ("accepted_at",) |
|
|
|
|
| @admin.register(DataExport) |
| class DataExportAdmin(admin.ModelAdmin): |
| list_display = ("user", "org", "status", "requested_at", "completed_at", "expires_at") |
| list_filter = ("status",) |
| search_fields = ("user__email",) |
|
|
|
|
| @admin.register(Deletion) |
| class DeletionAdmin(admin.ModelAdmin): |
| list_display = ("subject_type", "subject_id", "status", "scheduled_purge_at", "requested_at") |
| list_filter = ("subject_type", "status") |
|
|
|
|
| @admin.register(PIIAccessLog) |
| class PIIAccessLogAdmin(admin.ModelAdmin): |
| list_display = ("actor_user", "target_user", "field_accessed", "reason", "accessed_at") |
| list_filter = ("field_accessed",) |
| search_fields = ("actor_user__email", "target_user__email") |
| readonly_fields = ("accessed_at",) |
|
|
|
|
| @admin.register(UserDeletionLock) |
| class UserDeletionLockAdmin(admin.ModelAdmin): |
| list_display = ("user", "locked_by", "reason", "created_at") |
| search_fields = ("user__email",) |
|
|
|
|
| @admin.register(OrgDeletionLock) |
| class OrgDeletionLockAdmin(admin.ModelAdmin): |
| list_display = ("org", "locked_by", "reason", "created_at") |
|
|