* feat: added notifications for discussions app * feat: added unit tests for handler * feat: updated openedx-events package * fix: updated notification creation logic and tests * refactor: updated openedx-event version and event name * refactor: moved logic to separate methods
28 lines
715 B
Python
28 lines
715 B
Python
"""
|
|
Django Admin for Notifications
|
|
"""
|
|
|
|
from django.contrib import admin
|
|
|
|
from .models import CourseNotificationPreference, Notification
|
|
|
|
|
|
class NotificationAdmin(admin.ModelAdmin):
|
|
pass
|
|
|
|
|
|
class CourseNotificationPreferenceAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin for Course Notification Preferences
|
|
"""
|
|
model = CourseNotificationPreference
|
|
list_display = ['get_username', 'course_id', 'notification_preference_config']
|
|
|
|
@admin.display(description='Username', ordering='user__username')
|
|
def get_username(self, obj):
|
|
return obj.user.username
|
|
|
|
|
|
admin.site.register(Notification, NotificationAdmin)
|
|
admin.site.register(CourseNotificationPreference, CourseNotificationPreferenceAdmin)
|