Skip to content

Commit 45d9efc

Browse files
PetrDlouhyn2ygk
authored andcommitted
fix #1083 ('token' not valid search field), add search fields to all remaining admin classes (#1085)
* fix #1083 ('token' not valid search field), add search fields to all remaining admin classes
1 parent 4513459 commit 45d9efc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

oauth2_provider/admin.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class ApplicationAdmin(admin.ModelAdmin):
2525
"client_type": admin.HORIZONTAL,
2626
"authorization_grant_type": admin.VERTICAL,
2727
}
28+
search_fields = ("name",) + (("user__email",) if has_email else ())
2829
raw_id_fields = ("user",)
2930

3031

@@ -39,12 +40,13 @@ class AccessTokenAdmin(admin.ModelAdmin):
3940
class GrantAdmin(admin.ModelAdmin):
4041
list_display = ("code", "application", "user", "expires")
4142
raw_id_fields = ("user",)
43+
search_fields = ("code",) + (("user__email",) if has_email else ())
4244

4345

4446
class IDTokenAdmin(admin.ModelAdmin):
4547
list_display = ("jti", "user", "application", "expires")
4648
raw_id_fields = ("user",)
47-
search_fields = ("token",) + (("user__email",) if has_email else ())
49+
search_fields = ("user__email",) if has_email else ()
4850
list_filter = ("application",)
4951

5052

0 commit comments

Comments
 (0)