Update authtoken admin to make "user" a raw_id_field

If you have a large number of users this page will attempt to
load your entire User model dataset into a select box, which
will likely time out / crash the admin site.
This commit is contained in:
Hugo Rodger-Brown 2022-09-13 16:55:23 +01:00
parent acf6582de4
commit a7a68150f1
No known key found for this signature in database
GPG Key ID: DBA1B453A05A6DAC

View File

@ -22,6 +22,7 @@ class TokenChangeList(ChangeList):
class TokenAdmin(admin.ModelAdmin):
list_display = ('key', 'user', 'created')
raw_id_fields = ('user',)
fields = ('user',)
ordering = ('-created',)
actions = None # Actions not compatible with mapped IDs.