41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""
|
|
Notification Admin Configuration
|
|
"""
|
|
|
|
from django.contrib import admin
|
|
from unfold.admin import ModelAdmin
|
|
|
|
from .models import Notification
|
|
|
|
|
|
@admin.register(Notification)
|
|
class NotificationAdmin(ModelAdmin):
|
|
list_display = ['title', 'notification_type', 'severity', 'account', 'user', 'is_read', 'created_at']
|
|
list_filter = ['notification_type', 'severity', 'is_read', 'created_at']
|
|
search_fields = ['title', 'message', 'account__name', 'user__email']
|
|
readonly_fields = ['created_at', 'updated_at', 'read_at']
|
|
ordering = ['-created_at']
|
|
|
|
fieldsets = (
|
|
('Notification', {
|
|
'fields': ('account', 'user', 'notification_type', 'severity')
|
|
}),
|
|
('Content', {
|
|
'fields': ('title', 'message', 'site')
|
|
}),
|
|
('Action', {
|
|
'fields': ('action_url', 'action_label')
|
|
}),
|
|
('Status', {
|
|
'fields': ('is_read', 'read_at')
|
|
}),
|
|
('Metadata', {
|
|
'fields': ('metadata',),
|
|
'classes': ('collapse',)
|
|
}),
|
|
('Timestamps', {
|
|
'fields': ('created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
)
|