2022-01-21 15:26:08 +01:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2024-04-30 14:56:48 +02:00
|
|
|
from api.models.token import APIUserToken, OAuthToken
|
2022-01-21 15:26:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
class APITokenAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
"token",
|
|
|
|
"valid_until",
|
|
|
|
"is_active",
|
|
|
|
]
|
|
|
|
readonly_fields = [
|
|
|
|
"token"
|
|
|
|
]
|
2022-02-01 18:41:02 +01:00
|
|
|
search_fields = [
|
|
|
|
"token"
|
|
|
|
]
|
|
|
|
|
2022-01-21 15:26:08 +01:00
|
|
|
|
2024-04-30 14:56:48 +02:00
|
|
|
class OAuthTokenAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
"access_token",
|
|
|
|
"refresh_token",
|
|
|
|
"expires_on",
|
|
|
|
]
|
|
|
|
search_fields = [
|
|
|
|
"access_token",
|
|
|
|
"refresh_token",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2022-01-21 15:26:08 +01:00
|
|
|
admin.site.register(APIUserToken, APITokenAdmin)
|
2024-04-30 14:56:48 +02:00
|
|
|
admin.site.register(OAuthToken, OAuthTokenAdmin)
|