Add search_fields for fast token lookup

When there are many users it's tedious to find one in particular given the token. Similarly, we want to be able to find the token of a given user given its username or email.
This commit is contained in:
Stephane Poss 2016-07-29 11:32:57 +02:00 committed by GitHub
parent 48a2f084aa
commit 226d96ba36

View File

@ -4,6 +4,7 @@ from rest_framework.authtoken.models import Token
class TokenAdmin(admin.ModelAdmin):
search_fields = ("key", "user__username", "user__email")
list_display = ('key', 'user', 'created')
fields = ('user',)
ordering = ('-created',)