33 lines
1009 B
Python
33 lines
1009 B
Python
from django.contrib import admin
|
|
from .models import PushNotification, IAmPrincipalNotificationSettings
|
|
|
|
|
|
class PushNotificationAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"title",
|
|
"notification_category",
|
|
"principal_type",
|
|
"banner_image",
|
|
"message",
|
|
)
|
|
search_fields = ("title", "notification_category", "principal_type")
|
|
list_filter = ("notification_category", "principal_type")
|
|
|
|
|
|
admin.site.register(PushNotification, PushNotificationAdmin)
|
|
|
|
|
|
class IAmPrincipalNotificationSettingsAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "principal", "notification_category", "is_enabled")
|
|
search_fields = ("principal__first_name", "notification_category")
|
|
list_filter = ("notification_category", "is_enabled")
|
|
raw_id_fields = (
|
|
"principal",
|
|
) # This is useful if you have many users and a dropdown becomes impractical
|
|
|
|
|
|
admin.site.register(
|
|
IAmPrincipalNotificationSettings, IAmPrincipalNotificationSettingsAdmin
|
|
)
|