diff --git a/oauth2_provider/admin.py b/oauth2_provider/admin.py index 5b2c3c6e4..bd26dddb1 100644 --- a/oauth2_provider/admin.py +++ b/oauth2_provider/admin.py @@ -14,7 +14,8 @@ get_refresh_token_model, ) -has_email = hasattr(get_user_model(), 'email') + +has_email = hasattr(get_user_model(), "email") class ApplicationAdmin(admin.ModelAdmin): @@ -42,13 +43,11 @@ class GrantAdmin(admin.ModelAdmin): class IDTokenAdmin(admin.ModelAdmin): list_display = ("jti", "user", "application", "expires") - raw_id_fields = ("user", ) + raw_id_fields = ("user",) search_fields = ("token",) + (("user__email",) if has_email else ()) list_filter = ("application",) - - class RefreshTokenAdmin(admin.ModelAdmin): list_display = ("token", "user", "application") raw_id_fields = ("user", "access_token")