alesdotio/django-admin-shortcuts — pull request #3 by piquadrat (2012-10-11 07:34:53+00:00)
Title: optionally get the configuration from the context

this allows (in an unfortunately quite crude way) to set per-adminsite configuration:

from django.contrib.admin import AdminSite

class SimpleAdmin(AdminSite):
# todo: add templates here (see attrs on base class)
ADMIN_SHORTCUTS = [{
'shortcuts': [{
'url': '/',
'open_new_window': True,
},],
},]

def index(self, request, extra_context=None):
extra_context = extra_context or {}
extra_context['ADMIN_SHORTCUTS'] = self.ADMIN_SHORTCUTS
return super(SimpleAdmin, self).index(request, extra_context)

supplier_admin = SimpleAdmin()