You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
1010 B

from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from unfold.admin import ModelAdmin
from utils.admin import project_admin_site
from apps.account.models import User, Notification, NotificationTemplate
@admin.register(Notification, site=project_admin_site)
class NotificationAdmin(ModelAdmin):
list_display = ('title', 'user', 'notification_type', 'is_read', 'created_at')
list_filter = ('is_read', 'notification_type', 'created_at')
search_fields = ('title', 'message', 'user__fullname', 'user__email')
list_editable = ('is_read',)
ordering = ('-created_at',)
autocomplete_fields = ['user',]
@admin.register(NotificationTemplate, site=project_admin_site)
class NotificationTemplateAdmin(ModelAdmin):
list_display = ('name', 'notification_type', 'title', 'is_active')
list_filter = ('is_active',)
search_fields = ('name', 'notification_type', 'title', 'body')
list_editable = ('is_active',)
ordering = ('name',)