mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
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:
parent
48a2f084aa
commit
226d96ba36
|
@ -4,6 +4,7 @@ from rest_framework.authtoken.models import Token
|
||||||
|
|
||||||
|
|
||||||
class TokenAdmin(admin.ModelAdmin):
|
class TokenAdmin(admin.ModelAdmin):
|
||||||
|
search_fields = ("key", "user__username", "user__email")
|
||||||
list_display = ('key', 'user', 'created')
|
list_display = ('key', 'user', 'created')
|
||||||
fields = ('user',)
|
fields = ('user',)
|
||||||
ordering = ('-created',)
|
ordering = ('-created',)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user