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/djangoldp_webpushnotification/admin.py

20 lines
467 B
Python
Raw Normal View History

from django.contrib import admin
from djangoldp.admin import DjangoLDPAdmin
2021-04-07 15:18:09 +00:00
2021-04-07 14:19:39 +00:00
from .models import VAPIDKeyset
class VAPIDKeysetAdmin(DjangoLDPAdmin):
2021-04-07 15:18:09 +00:00
readonly_fields = ('public_key_view', 'private_key_view')
2021-04-07 15:18:09 +00:00
def public_key_view(self, obj):
return obj.public_key
2021-04-07 15:18:09 +00:00
def private_key_view(self, obj):
return obj.private_key.tobytes()
2021-04-07 15:18:09 +00:00
class Meta:
verbose_name = 'VAPID key-set'
2021-04-07 14:19:39 +00:00
admin.site.register(VAPIDKeyset, VAPIDKeysetAdmin)