www-bocal/api/admin.py

15 lines
430 B
Python
Raw Normal View History

2017-09-23 21:40:45 +02:00
from django.contrib import admin
2017-09-24 18:20:10 +02:00
from . import models
2017-09-23 21:40:45 +02:00
2017-09-24 18:20:10 +02:00
@admin.register(models.ApiKey)
class ApiKeyAdmin(admin.ModelAdmin):
list_display = ["name", "last_used", "displayValue"]
readonly_fields = ["keyId", "key", "last_used", "displayValue"]
2017-09-24 18:20:10 +02:00
def save_model(self, request, obj, form, change):
if not change:
obj.initialFill()
super(ApiKeyAdmin, self).save_model(request, obj, form, change)