django-orchestra/orchestra/admin/dashboard.py

32 lines
1.2 KiB
Python
Raw Normal View History

2015-04-26 13:53:00 +00:00
from fluent_dashboard import dashboard
from fluent_dashboard.modules import CmsAppIconList
2014-05-08 16:59:35 +00:00
from orchestra.core import services
2015-04-26 13:53:00 +00:00
class OrchestraIndexDashboard(dashboard.FluentIndexDashboard):
def get_application_modules(self):
modules = super(OrchestraIndexDashboard, self).get_application_modules()
models = []
for model, options in services.get().items():
if options.get('menu', True):
models.append("%s.%s" % (model.__module__, model._meta.object_name))
# TODO make this dynamic
for module in modules:
if module.title == 'Administration':
module.children.append({
'models': [{
'add_url': '/admin/settings/',
'app_name': 'settings',
'change_url': '/admin/settings/setting/',
'name': 'setting',
'title': "Settings" }],
'name': 'settings',
'title': 'Settings',
'url': '/admin/settings/'
})
service_icon_list = CmsAppIconList('Services', models=models, collapsible=True)
modules.append(service_icon_list)
return modules