﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33931	Optimize calling of `get_app_list` with AdminSites index/app_index	Daniel Hahler	Daniel Hahler	"`AdminSite.index` gets the list of available apps twice: for `app_list` and `available_apps` in the context.

Code ref: https://github.com/django/django/blob/bee09df39fe0734eb2388a2b3439436796592820/django/contrib/admin/sites.py#L547-L555

I think this can be optimized to only call it once.

With `app_index` it could also be filtered in `app_index` itself.

The benefit of this is handling the use case of moving apps around in `get_app_list` (from `custom_auth` into `auth`, after calling the default method), which fails when the list is filtered by `app_label` before.

I think changing `index` makes sense, and is the far more often used code path, but changing `app_index` might break some projects, where by now it might be expected that `get_app_list` gets called with an `app_label` - and optimizing it there removed the internal use of calling `get_app_list` with `app_label` completely again.  (This was changed in Django 4.1: https://code.djangoproject.com/ticket/7497)"	Cleanup/optimization	assigned	contrib.admin	4.1	Normal			Roman	Accepted	1	0	0	1	0	0
