from django.contrib import admin from .models import NotificationJob,NotificationPolicy,SMSTemplate @admin.register(NotificationJob) class NotificationJobAdmin(admin.ModelAdmin): list_display=("channel","event_type","status","attempts","provider_status_code","delivery_status","provider_message_id","created_at"); list_filter=("channel","status","delivery_status"); readonly_fields=("provider_message_id","provider_status_code","delivery_status_code","delivery_description","delivery_checked_at","dedupe_key","created_at","sent_at") @admin.register(SMSTemplate) class SMSTemplateAdmin(admin.ModelAdmin): list_display=("event_type","unit","title","is_active","updated_at") list_filter=("unit","is_active","event_type") readonly_fields=("allowed_tags",) @admin.register(NotificationPolicy) class NotificationPolicyAdmin(admin.ModelAdmin): list_display=("key","quiet_period_seconds","is_active","updated_at") def has_add_permission(self,request): return NotificationPolicy.objects.count()