mpeltriaux
8ff3cb9adc
* adds migrations for storing OAuthToken * adds OAuthToken model * adds OAuthToken admin * adds user migration for Fkey relation to OAuthToken
34 lines
625 B
Python
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)
|