mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
Use raw_id_fields to avoid selecting all users
In most applications, there are many users, this will lead to a non performant admin page if you want to modify or add a new token.
This commit is contained in:
parent
bf9533ae37
commit
0f66297b77
|
@ -3,10 +3,9 @@ from django.contrib import admin
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Token)
|
||||||
class TokenAdmin(admin.ModelAdmin):
|
class TokenAdmin(admin.ModelAdmin):
|
||||||
list_display = ('key', 'user', 'created')
|
list_display = ('key', 'user', 'created')
|
||||||
fields = ('user',)
|
fields = ('user',)
|
||||||
ordering = ('-created',)
|
ordering = ('-created',)
|
||||||
|
raw_id_fields = ('user',)
|
||||||
|
|
||||||
admin.site.register(Token, TokenAdmin)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user