Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accesstoken and ThrottledApplication to admin panel #3836

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 44 additions & 0 deletions api/api/admin/__init__.py
@@ -1,8 +1,11 @@
from django.contrib import admin

from oauth2_provider.models import AccessToken

from api.admin.site import openverse_admin
from api.models import PENDING, Audio, AudioReport, ContentProvider, Image, ImageReport
from api.models.media import AbstractDeletedMedia, AbstractSensitiveMedia
from api.models.oauth import ThrottledApplication


admin.site = openverse_admin
Expand Down Expand Up @@ -83,3 +86,44 @@ class ProviderAdmin(admin.ModelAdmin):
list_display = ("provider_name", "provider_identifier", "media_type")
search_fields = ("provider_name", "provider_identifier")
ordering = ("media_type", "provider_name")


@admin.register(ThrottledApplication)
class ThrottledApplicationAdmin(admin.ModelAdmin):
search_fields = ("client_id", "name", "rate_limit_model")
list_display = ("client_id", "name", "created", "rate_limit_model")
ordering = ("-created",)

readonly_fields = (
"skip_authorization",
"verified",
"client_id",
"name",
"user",
"algorithm",
"redirect_uris",
"post_logout_redirect_uris",
"client_type",
"authorization_grant_type",
"client_secret",
)


@admin.register(AccessToken)
class AccessTokenAdmin(admin.ModelAdmin):
search_fields = ("token", "id")
list_display = ("token", "id", "created", "scope", "expires")
ordering = ("-created",)

readonly_fields = (
"id",
"user",
"source_refresh_token",
"token",
"id_token",
"application",
"expires",
"scope",
"created",
"updated",
)