Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions osf/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import waffle

from osf.external.spam.tasks import reclassify_domain_references
from osf.models import OSFUser, Node, NotableDomain, NodeLicense, NotificationType, NotificationSubscription, EmailTask
from osf.models import OSFUser, Node, NotableDomain, NodeLicense, NotificationType, NotificationSubscription, EmailTask, Notification
from osf.models.notification_type import get_default_frequency_choices
from osf.models.notable_domain import DomainReference

Expand Down Expand Up @@ -320,6 +320,7 @@ def __init__(self, *args, **kwargs):
class NotificationSubscriptionAdmin(admin.ModelAdmin):
list_display = ('user', 'notification_type', 'message_frequency', 'subscribed_object', 'preview_button')
form = NotificationSubscriptionForm
search_fields = ('notification_type__name', 'user__username')

class Media:
js = ['admin/notification_subscription.js']
Expand Down Expand Up @@ -361,7 +362,22 @@ def get_intervals(self, request, pk):
class EmailTaskAdmin(admin.ModelAdmin):
list_display = ('task_id', 'user', 'status', 'created_at', 'updated_at')
list_filter = ('status',)
search_fields = ('task_id', 'user__email')
search_fields = ('task_id', 'user__username')


@admin.register(Notification)
class NotificationAdmin(admin.ModelAdmin):
list_display = ('user', 'notification_type_name', 'sent', 'seen', 'event_context')
list_filter = ('sent',)
search_fields = ('subscription__notification_type__name', 'subscription__user__username')

def notification_type_name(self, obj):
return obj.subscription.notification_type.name
notification_type_name.short_description = 'Notification Type'

def user(self, obj):
return obj.subscription.user.username
user.short_description = 'User'

admin.site.register(OSFUser, OSFUserAdmin)
admin.site.register(Node, NodeAdmin)
Expand Down
Loading