#15571: AdminSite index and app_index methods could include the model_admin in the model_dict -------------------------------------------+--------------------------- Reporter: batiste | Owner: nobody Status: new | Milestone: Component: django.contrib.admin | Version: 1.2 Keywords: admin, AdminSite, model_admin | Triage Stage: Unreviewed Has patch: 0 | -------------------------------------------+--------------------------- 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. -- Ticket URL: <http://code.djangoproject.com/ticket/15571> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.