konova/api/admin.py
mpeltriaux 8ff3cb9adc # OAuth migrations
* adds migrations for storing OAuthToken
* adds OAuthToken model
* adds OAuthToken admin
* adds user migration for Fkey relation to OAuthToken
2024-04-30 14:56:48 +02:00

34 lines
625 B
Python

from django.contrib import admin
from api.models.token import APIUserToken, OAuthToken
class APITokenAdmin(admin.ModelAdmin):
list_display = [
"token",
"valid_until",
"is_active",
]
readonly_fields = [
"token"
]
search_fields = [
"token"
]
class OAuthTokenAdmin(admin.ModelAdmin):
list_display = [
"access_token",
"refresh_token",
"expires_on",
]
search_fields = [
"access_token",
"refresh_token",
]
admin.site.register(APIUserToken, APITokenAdmin)
admin.site.register(OAuthToken, OAuthTokenAdmin)