1 from django
.utils
.translation
import ugettext_lazy
as _
2 from admin_tools
.dashboard
import modules
, Dashboard
, AppIndexDashboard
3 from savoirs
.models
import Record
4 from savoirs
.admin_views
import RecordDashboard
6 # to activate your index dashboard add the following to your settings.py:
8 # ADMIN_TOOLS_INDEX_DASHBOARD = 'auf_savoirs_en_partage.dashboard.CustomIndexDashboard'
10 class CustomIndexDashboard(Dashboard
):
12 Custom index dashboard for auf_savoirs_en_partage.
14 def __init__(self
, **kwargs
):
15 Dashboard
.__init__(self
, **kwargs
)
17 def init_with_context(self
, context
):
19 Use this method if you need to access the request context.
21 # append another link list module for "support".
22 #self.children.append(modules.LinkList(
26 # 'title': _(u'Reporter un probleme JUTDA'),
27 # 'url': 'http://jutda.auf.org/',
33 # append an app list module for "Applications"
34 self
.children
.append(modules
.AppList(
35 title
=_('Applications'),
36 exclude_list
=('django.contrib',),
39 # append an app list module for "Administration"
40 #self.children.append(modules.AppList(
41 # title=_('Administration'),
42 # include_list=('django.contrib',),
45 # append a recent actions module
46 #self.children.append(modules.RecentActions(
47 # title=_('Recent Actions'),
51 # append another link list module for "RecordDashboard".
52 ref_dash
= RecordDashboard(context
)
53 self
.children
.append(modules
.LinkList(
54 title
=_('Reference a completer') + " (%d restantes)" % ref_dash
.total_a_faire(),
55 children
=ref_dash
.a_traiter()
59 # to activate your app index dashboard add the following to your settings.py:
61 # ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'auf_savoirs_en_partage.dashboard.CustomAppIndexDashboard'
63 class CustomAppIndexDashboard(AppIndexDashboard
):
65 Custom app index dashboard for auf_savoirs_en_partage.
67 def __init__(self
, *args
, **kwargs
):
68 AppIndexDashboard
.__init__(self
, *args
, **kwargs
)
70 # we disable title because its redundant with the model list module
73 # append a model list module
74 self
.children
.append(modules
.ModelList(
76 include_list
=self
.models
,
79 # append a recent actions module
80 self
.children
.append(modules
.RecentActions(
81 title
=_('Recent Actions'),
82 include_list
=self
.get_app_content_types(),
85 def init_with_context(self
, context
):
87 Use this method if you need to access the request context.