django-notifications/notifications/admin.py

22 lines
706 B
Python
Raw Normal View History

''' Django notifications admin file '''
# -*- coding: utf-8 -*-
from django.contrib import admin
2020-04-08 21:40:02 +00:00
from notifications.base.admin import AbstractNotificationAdmin
from swapper import load_model
Notification = load_model('notifications', 'Notification')
2015-12-11 13:32:20 +00:00
2020-04-08 21:40:02 +00:00
class NotificationAdmin(AbstractNotificationAdmin):
raw_id_fields = ('recipient',)
list_display = ('recipient', 'actor',
'level', 'target', 'unread', 'public')
list_filter = ('level', 'unread', 'public', 'timestamp',)
def get_queryset(self, request):
qs = super(NotificationAdmin, self).get_queryset(request)
return qs.prefetch_related('actor')
admin.site.register(Notification, NotificationAdmin)