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.
2021-04-07 13:44:56 +00:00
|
|
|
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
|
|
|
|
|
2021-04-07 13:44:56 +00:00
|
|
|
|
|
|
|
class VAPIDKeysetAdmin(DjangoLDPAdmin):
|
2021-04-07 15:18:09 +00:00
|
|
|
readonly_fields = ('public_key_view', 'private_key_view')
|
2021-04-07 13:44:56 +00:00
|
|
|
|
2021-04-07 15:18:09 +00:00
|
|
|
def public_key_view(self, obj):
|
|
|
|
return obj.public_key
|
2021-04-07 13:44:56 +00:00
|
|
|
|
2021-04-07 15:18:09 +00:00
|
|
|
def private_key_view(self, obj):
|
|
|
|
return obj.private_key.tobytes()
|
2021-04-07 15:06:40 +00:00
|
|
|
|
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)
|