django-rest-durin icon indicating copy to clipboard operation
django-rest-durin copied to clipboard

AuthTokenAdmin list_filter is causing performance problems (mostly timeouts)

Open sunweiyang opened this issue 2 years ago • 1 comments

Our app has ~50k User objects and even more Client objects, and currently, because of AuthTokenAdmin's list_filter, our app times out every time we access the AuthToken list page in Django admin (because the filter lists every single one of these User and Client objects as possible filters). Can AuthTokenAdmin's list_filter be removed?

sunweiyang avatar Jun 17 '22 04:06 sunweiyang

Hi.

You make a solid point and ideally it should not have been there but I don't know how soon I'll be able to ship a new release with this change. Meanwhile, you should easily be able to override the AuthTokenAdmin class and customize it as per your need, like so:

from durin.admin import AuthTokenAdmin
from durin.models import AuthToken

class CustomAuthTokenAdmin(AuthTokenAdmin):
    list_filter = []

# Unregister the default admin view for AuthToken
admin.site.unregister(AuthToken)
# Register our custom admin view for AuthToken
admin.site.register(AuthToken, CustomAuthTokenAdmin)

eshaan7 avatar Jul 06 '22 14:07 eshaan7