36 lines
890 B
Python
36 lines
890 B
Python
from vbv_lernwelt.core.admin import LogAdmin
|
|
|
|
|
|
# admin.register in apps.py
|
|
class CustomNotificationAdmin(LogAdmin):
|
|
date_hierarchy = "timestamp"
|
|
raw_id_fields = ("recipient",)
|
|
search_fields = (("recipient__username"),)
|
|
list_display = (
|
|
"timestamp",
|
|
"recipient",
|
|
"actor",
|
|
"notification_category",
|
|
"notification_trigger",
|
|
"course_session",
|
|
"emailed",
|
|
"unread",
|
|
)
|
|
list_filter = (
|
|
"notification_category",
|
|
"notification_trigger",
|
|
"emailed",
|
|
"unread",
|
|
"timestamp",
|
|
# "level",
|
|
# "public",
|
|
"course_session",
|
|
)
|
|
|
|
def get_queryset(self, request):
|
|
qs = super(CustomNotificationAdmin, self).get_queryset(request)
|
|
return qs.prefetch_related("actor")
|
|
|
|
def has_delete_permission(self, request, obj=None):
|
|
return True
|