-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: admin panel configuration for engagement app
- Loading branch information
1 parent
6419665
commit 1975599
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from django.contrib import admin | ||
from .models import ( | ||
NotifiableEvent, | ||
NotificationPreference, | ||
AppNotificationTemplate, | ||
AppNotification, | ||
EmailNotificationTemplate, | ||
EmailNotification | ||
) | ||
|
||
@admin.register(NotifiableEvent) | ||
class NotifiableEventAdmin(admin.ModelAdmin): | ||
list_display = ('event_type', 'person', 'created_at', 'delete_at') | ||
list_filter = ('event_type', 'created_at') | ||
search_fields = ('person__email', 'person__first_name', 'person__last_name') | ||
readonly_fields = ('created_at',) | ||
|
||
@admin.register(NotificationPreference) | ||
class NotificationPreferenceAdmin(admin.ModelAdmin): | ||
list_display = ('person', 'product_notifications') | ||
search_fields = ('person__email', 'person__first_name', 'person__last_name') | ||
readonly_fields = ('created_at',) | ||
|
||
@admin.register(AppNotificationTemplate) | ||
class AppNotificationTemplateAdmin(admin.ModelAdmin): | ||
list_display = ('event_type', 'title') | ||
search_fields = ('event_type', 'title', 'template') | ||
|
||
@admin.register(AppNotification) | ||
class AppNotificationAdmin(admin.ModelAdmin): | ||
list_display = ('person', 'title', 'is_read', 'read_at', 'created_at') | ||
list_filter = ('is_read', 'created_at', 'read_at') | ||
search_fields = ('person__email', 'title', 'message') | ||
readonly_fields = ('created_at',) | ||
|
||
@admin.register(EmailNotificationTemplate) | ||
class EmailNotificationTemplateAdmin(admin.ModelAdmin): | ||
list_display = ('event_type', 'title') | ||
search_fields = ('event_type', 'title', 'template') | ||
|
||
@admin.register(EmailNotification) | ||
class EmailNotificationAdmin(admin.ModelAdmin): | ||
list_display = ('person', 'title', 'sent_at', 'delete_at') | ||
list_filter = ('sent_at',) | ||
search_fields = ('person__email', 'title', 'body') | ||
readonly_fields = ('created_at',) |