mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
TokenAdmin: add 'user' to autocomplete_fields (#6762)
TokenAdmin is unusable with a big number of user records (in this case ~150k). Django 2.0 added the [ModelAdmin.autocomplete_fields](https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields) option to use select2 to provide a better user experience. If support for django 1.11 is dropped, this change would make the `TokenAdmin` usable again.
This commit is contained in:
parent
f76480a127
commit
cfd3ea0996
|
@ -7,6 +7,7 @@ class TokenAdmin(admin.ModelAdmin):
|
|||
list_display = ('key', 'user', 'created')
|
||||
fields = ('user',)
|
||||
ordering = ('-created',)
|
||||
autocomplete_fields = ('user',)
|
||||
|
||||
|
||||
admin.site.register(Token, TokenAdmin)
|
||||
|
|
Loading…
Reference in New Issue
Block a user