48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
"""
|
|
Admin configuration for legal app.
|
|
"""
|
|
from django.contrib import admin
|
|
from .models import ConsentRecord, DataRequest, SecurityEvent
|
|
|
|
|
|
@admin.register(ConsentRecord)
|
|
class ConsentRecordAdmin(admin.ModelAdmin):
|
|
"""Consent record admin."""
|
|
list_display = ('user', 'consent_type', 'consent_given', 'timestamp', 'version')
|
|
list_filter = ('consent_type', 'consent_given', 'timestamp')
|
|
search_fields = ('user__username', 'user__email')
|
|
readonly_fields = ('timestamp',)
|
|
date_hierarchy = 'timestamp'
|
|
|
|
|
|
@admin.register(DataRequest)
|
|
class DataRequestAdmin(admin.ModelAdmin):
|
|
"""Data request admin."""
|
|
list_display = ('user', 'request_type', 'status', 'requested_at', 'completed_at', 'handled_by')
|
|
list_filter = ('request_type', 'status', 'requested_at')
|
|
search_fields = ('user__username', 'user__email', 'description')
|
|
readonly_fields = ('requested_at',)
|
|
date_hierarchy = 'requested_at'
|
|
|
|
fieldsets = (
|
|
('Request Information', {
|
|
'fields': ('user', 'request_type', 'status', 'description')
|
|
}),
|
|
('Response', {
|
|
'fields': ('response_data', 'response_file', 'notes')
|
|
}),
|
|
('Handling', {
|
|
'fields': ('handled_by', 'requested_at', 'completed_at')
|
|
}),
|
|
)
|
|
|
|
|
|
@admin.register(SecurityEvent)
|
|
class SecurityEventAdmin(admin.ModelAdmin):
|
|
"""Security event admin."""
|
|
list_display = ('event_type', 'user', 'severity', 'ip_address', 'timestamp', 'resolved')
|
|
list_filter = ('event_type', 'severity', 'resolved', 'timestamp')
|
|
search_fields = ('user__username', 'ip_address')
|
|
readonly_fields = ('timestamp',)
|
|
date_hierarchy = 'timestamp'
|