| 1 | # -*- encoding: utf-8 -* |
| 2 | |
| 3 | """ |
| 4 | This file was generated with the customdashboard management command, it |
| 5 | contains the two classes for the main dashboard and app index dashboard. |
| 6 | You can customize these classes as you want. |
| 7 | |
| 8 | To activate your index dashboard add the following to your settings.py:: |
| 9 | ADMIN_TOOLS_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomIndexDashboard' |
| 10 | |
| 11 | And to activate the app index dashboard:: |
| 12 | ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomAppIndexDashboard' |
| 13 | """ |
| 14 | |
| 15 | from django.utils.translation import ugettext_lazy as _ |
| 16 | from django.core.urlresolvers import reverse |
| 17 | |
| 18 | from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard |
| 19 | from admin_tools.utils import get_admin_site_name |
| 20 | |
| 21 | |
| 22 | class CustomIndexDashboard(Dashboard): |
| 23 | """ |
| 24 | Custom index dashboard for SIGMA. |
| 25 | """ |
| 26 | def init_with_context(self, context): |
| 27 | site_name = get_admin_site_name(context) |
| 28 | |
| 29 | # append an app list module for "Applications" |
| 30 | self.children.append(modules.AppList( |
| 31 | _('Applications'), |
| 32 | exclude=('django.contrib.*',), |
| 33 | )) |
| 34 | |
| 35 | # append an app list module for "Administration" |
| 36 | self.children.append(modules.AppList( |
| 37 | _('Administration'), |
| 38 | models=('django.contrib.*',), |
| 39 | )) |
| 40 | |
| 41 | # append a recent actions module |
| 42 | self.children.append(modules.RecentActions(_('Recent Actions'), 5)) |