This repository has been archived on 2021-04-21. You can view files and clone it, but cannot push or open issues or pull requests.
djangoldp-webpushnotification/admin.py

24 lines
736 B
Python
Raw Normal View History

from django.contrib import admin
from djangoldp.admin import DjangoLDPAdmin
from djangoldp.models import Model
from .models import Notification, NotificationSetting, Subscription, VAPIDKeyset
class NotificationSettingAdmin(DjangoLDPAdmin):
ordering = ['urlid']
class VAPIDKeysetAdmin(DjangoLDPAdmin):
readonly_fields = ('public_key_view', 'private_key_view')
def public_key_view(self, obj):
return obj.public_key.tobytes()
def private_key_view(self, obj):
return obj.private_key.tobytes()
admin.site.register(Notification, NotificationAdmin)
admin.site.register(Subscription, SubscriptionAdmin)
admin.site.register(NotificationSetting, NotificationSettingAdmin)
admin.site.register(VAPIDKeyset, VAPIDKeysetAdmin)