Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slowness due to loading all options #14

Open
salomvary opened this issue Oct 21, 2022 · 1 comment
Open

Slowness due to loading all options #14

salomvary opened this issue Oct 21, 2022 · 1 comment

Comments

@salomvary
Copy link
Contributor

I was investigating an admin list page slowness and found out that all options are queried and loaded into memory, which, in case of a large number of options (usually the motivation itself for using autocomplate) makes the page load very slowly.

Stack trace leading to the problem looks like this:

django/contrib/admin/options.py in wrapper(686)
  return self.admin_site.admin_view(view)(*args, **kwargs)

django/views/decorators/cache.py in _wrapped_view_func(62)
  response = view_func(request, *args, **kwargs)

django/contrib/admin/sites.py in inner(242)
  return view(request, *args, **kwargs)

django/contrib/admin/options.py in changelist_view(1931)
  cl = self.get_changelist_instance(request)

django/contrib/admin/options.py in get_changelist_instance(834)
  return ChangeList(

django/contrib/admin/views/main.py in __init__(122)
  self.queryset = self.get_queryset(request)

django/contrib/admin/views/main.py in get_queryset(503)
  ) = self.get_filters(request)

django/contrib/admin/views/main.py in get_filters(182)
  spec = field_list_filter_class(

djaa_list_filter/admin.py in __init__(53)
  super().__init__(field, request, params, model, model_admin, field_path)

django/contrib/admin/filters.py in __init__(188)
  self.lookup_choices = self.field_choices(field, request, model_admin)

django/contrib/admin/filters.py in field_choices(225)
  return field.get_choices(include_blank=False, ordering=ordering)

Using Django 4.1.1.

salomvary added a commit to salomvary/django-admin-autocomplete-list-filter that referenced this issue Oct 21, 2022
salomvary added a commit to salomvary/django-admin-autocomplete-list-filter that referenced this issue Oct 21, 2022
@vigo
Copy link
Collaborator

vigo commented May 20, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants