﻿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
15571	AdminSite index and app_index methods could include the model_admin in the model_dict	Batiste Bieler	nobody	"When sub-classing the ""index.html"" template for the admin interface, I wanted to show or hide some models (without disabling them, ie: still reachable in the admin as usual).

The model_dict doesn't contain the model_admin, so I needed to subclass the index method just to add this line:

{{{
model_dict = {
    'name': capfirst(model._meta.verbose_name_plural),
    'admin_url': mark_safe('%s/%s/' % (app_label, model.__name__.lower())),
    'perms': perms,
    'model_admin': model_admin, # added just this line
}
}}}

Then I can add some attribute ""index_hide"" to my ModelAdmin, and use it in my subclassed index.html to decide what to show.

Would it be a good idea to add this line to the admin, even if there is no use in the original template? 

I believe it reflect some kind of common use-case. The need to access the model_admin within the index template seems natural to me.
"	New feature	closed	contrib.admin	1.2	Normal	wontfix	admin, AdminSite, model_admin	sverrejoh	Accepted	0	0	0	0	0	0
