[#2380] Réorganisation des modèles dans le dashboard de l'app RH comment le principal
[auf_rh_dae.git] / project / dashboard.py
CommitLineData
8846b99e
OL
1# -*- encoding: utf-8 -*
2
3"""
4This file was generated with the customdashboard management command, it
5contains the two classes for the main dashboard and app index dashboard.
6You can customize these classes as you want.
7
8To activate your index dashboard add the following to your settings.py::
9 ADMIN_TOOLS_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomIndexDashboard'
10
11And to activate the app index dashboard::
12 ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomAppIndexDashboard'
13"""
14
15from django.utils.translation import ugettext_lazy as _
16from django.core.urlresolvers import reverse
17
18from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
19from admin_tools.utils import get_admin_site_name
20
21
22class 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'),
d69f7f42
DB
32 models=(
33 'project.dae.models.*',
34 'project.recrutement.models.*',
56fdab08 35 'project.rh.models.AyantDroit',
d69f7f42
DB
36 'project.rh.models.Dossier',
37 'project.rh.models.Employe',
38 'project.rh.models.Poste',
39 ),
40 ))
41
42 # append an app list module for "Configuration"
43 self.children.append(modules.AppList(
44 _('Configuration'),
45 models=(
56fdab08
OL
46 'project.rh.models.Classement',
47 'project.rh.models.Devise',
48 'project.rh.models.FamilleEmploi',
49 'project.rh.models.OrganismeBstg',
50 'project.rh.models.Responsable',
51 'project.rh.models.Service',
52 'project.rh.models.Statut',
53 'project.rh.models.TauxChange',
54 'project.rh.models.TypeContrat',
55 'project.rh.models.TypePoste',
56 'project.rh.models.TypeRevalorisation',
57 'project.rh.models.TypeRemuneration',
58 'project.rh.models.ValeurPoint',
59 ),
8846b99e
OL
60 ))
61
d69f7f42
DB
62 # append an app list module for "Inter-systèmes"
63 self.children.append(modules.AppList(
64 _(u'Inter-systèmes'),
65 models=(
66 'project.rh.models.ResponsableImplantation',
67 ),
68 ))
69
8846b99e
OL
70 # append an app list module for "Administration"
71 self.children.append(modules.AppList(
72 _('Administration'),
d69f7f42
DB
73 models=(
74 'django.contrib.*',
75 ),
8846b99e
OL
76 ))
77
78 # append a recent actions module
79 self.children.append(modules.RecentActions(_('Recent Actions'), 5))
7f43054e
PP
80
81
82class CustomAppIndexDashboard(AppIndexDashboard):
83 """
84 Custom app index dashboard for project.
85 """
86
87 # we disable title because its redundant with the model list module
88 title = ''
89
90 def __init__(self, *args, **kwargs):
91 AppIndexDashboard.__init__(self, *args, **kwargs)
92
93 def init_with_context(self, context):
94 """
95 Use this method if you need to access the request context.
96 """
97 if self.app_title != 'Rh':
98 # append a model list module and a recent actions module
99 self.children += [
100 modules.ModelList(self.app_title,self.models),
101 modules.RecentActions(
102 _('Recent Actions'),
103 include_list=self.get_app_content_types(),
104 limit=5
105 )
106 ]
107
108 return
109
110 # append an app list module for "Application"
111 self.children.append(modules.AppList(
112 _('Application'),
113 models=(
114 'project.rh.models.AyantDroit',
115 'project.rh.models.Dossier',
116 'project.rh.models.Employe',
117 'project.rh.models.Poste',
118 ),
119 ))
120
121 # append an app list module for "Configuration"
122 self.children.append(modules.AppList(
123 _('Configuration'),
124 models=(
125 'project.rh.models.Classement',
126 'project.rh.models.Devise',
127 'project.rh.models.FamilleEmploi',
128 'project.rh.models.OrganismeBstg',
129 'project.rh.models.Responsable',
130 'project.rh.models.Service',
131 'project.rh.models.Statut',
132 'project.rh.models.TauxChange',
133 'project.rh.models.TypeContrat',
134 'project.rh.models.TypePoste',
135 'project.rh.models.TypeRevalorisation',
136 'project.rh.models.TypeRemuneration',
137 'project.rh.models.ValeurPoint',
138 ),
139 ))
140
141 # append an app list module for "Inter-systèmes"
142 self.children.append(modules.AppList(
143 _(u'Inter-systèmes'),
144 models=(
145 'project.rh.models.ResponsableImplantation',
146 ),
147 ))
148
149 # append a recent actions module
150 self.children.append(modules.RecentActions(
151 _('Recent Actions'),
152 include_list=self.get_app_content_types(),
153 limit=5
154 ))