[#3262] Mettre de l'ordre dans le dashboard
[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
8846b99e 15from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
fc4bf968 16from django.utils.translation import ugettext_lazy as _
8846b99e 17
8846b99e
OL
18class CustomIndexDashboard(Dashboard):
19 """
e1a81904 20 Custom index dashboard for SGRH.
8846b99e
OL
21 """
22 def init_with_context(self, context):
8846b99e
OL
23
24 # append an app list module for "Applications"
e1a81904 25 self.children.append(modules.Group(
8846b99e 26 _('Applications'),
e1a81904
PP
27 display='stacked',
28 children=[
29 modules.ModelList(
30 title='Demande d\'autorisation d\'engagement',
31 models=(
32 'project.dae.models.*',
33 )
34 ),
35 modules.ModelList(
36 title='Gestion des candidatures',
37 models=(
38 'auf.django.emploi.models.OffreEmploi',
39 'project.recrutement.models.ProxyOffreEmploi',
40 'auf.django.emploi.models.Candidat',
41 'project.recrutement.models.ProxyCandidat',
42 'project.recrutement.models.CandidatEvaluation',
43 'project.recrutement.models.MesCandidatEvaluation',
44 'project.recrutement.models.Evaluateur',
45 'project.recrutement.models.CourrielTemplate',
46 )
47 ),
48 modules.ModelList(
49 title='Gestion des personnels',
50 models=(
51 'project.rh.models.AyantDroit',
52 'project.rh.models.Dossier',
53 'project.rh.models.DossierInactif',
54 'project.rh.models.Employe',
55 'project.rh.models.EmployeInactif',
56 'project.rh.models.Poste',
57 )
58 ),
59 ]
d69f7f42
DB
60 ))
61
62 # append an app list module for "Configuration"
63 self.children.append(modules.AppList(
64 _('Configuration'),
65 models=(
fc4bf968
EMS
66 'project.rh.models.Classement',
67 'project.rh.models.Devise',
68 'project.rh.models.CategorieEmploi',
321fe481 69 'project.rh.models.FamilleProfessionnelle',
fc4bf968
EMS
70 'project.rh.models.OrganismeBstg',
71 'project.rh.models.Responsable',
72 'project.rh.models.Service',
73 'project.rh.models.Statut',
74 'project.rh.models.TauxChange',
75 'project.rh.models.TypeContrat',
76 'project.rh.models.TypePoste',
77 'project.rh.models.TypeRevalorisation',
78 'project.rh.models.TypeRemuneration',
79 'project.rh.models.ValeurPoint',
56fdab08 80 ),
8846b99e
OL
81 exclude=('django.contrib.*',),
82 ))
83
d69f7f42
DB
84 # append an app list module for "Inter-systèmes"
85 self.children.append(modules.AppList(
86 _(u'Inter-systèmes'),
87 models=(
fc4bf968 88 'project.rh.models.ResponsableImplantation',
d69f7f42
DB
89 ),
90 ))
91
8846b99e
OL
92 # append an app list module for "Administration"
93 self.children.append(modules.AppList(
94 _('Administration'),
d69f7f42 95 models=(
fc4bf968 96 'django.contrib.*',
d69f7f42 97 ),
8846b99e
OL
98 ))
99
7f43054e
PP
100class CustomAppIndexDashboard(AppIndexDashboard):
101 """
102 Custom app index dashboard for project.
103 """
104
105 # we disable title because its redundant with the model list module
106 title = ''
107
108 def __init__(self, *args, **kwargs):
109 AppIndexDashboard.__init__(self, *args, **kwargs)
110
111 def init_with_context(self, context):
112 """
113 Use this method if you need to access the request context.
114 """
115 if self.app_title != 'Rh':
116 # append a model list module and a recent actions module
117 self.children += [
fc4bf968 118 modules.ModelList(self.app_title, self.models),
7f43054e
PP
119 ]
120
121 return
122
123 # append an app list module for "Application"
124 self.children.append(modules.AppList(
125 _('Application'),
126 models=(
fc4bf968
EMS
127 'project.rh.models.AyantDroit',
128 'project.rh.models.Dossier',
129 'project.rh.models.DossierInactif',
130 'project.rh.models.Employe',
131 'project.rh.models.EmployeInactif',
132 'project.rh.models.Poste',
7f43054e
PP
133 ),
134 ))
135
136 # append an app list module for "Configuration"
137 self.children.append(modules.AppList(
138 _('Configuration'),
139 models=(
fc4bf968
EMS
140 'project.rh.models.Classement',
141 'project.rh.models.Devise',
142 'project.rh.models.CategorieEmploi',
321fe481 143 'project.rh.models.FamilleProfessionnelle',
fc4bf968
EMS
144 'project.rh.models.OrganismeBstg',
145 'project.rh.models.Responsable',
146 'project.rh.models.Service',
147 'project.rh.models.Statut',
148 'project.rh.models.TauxChange',
149 'project.rh.models.TypeContrat',
150 'project.rh.models.TypePoste',
151 'project.rh.models.TypeRevalorisation',
152 'project.rh.models.TypeRemuneration',
153 'project.rh.models.ValeurPoint',
7f43054e
PP
154 ),
155 ))
156
157 # append an app list module for "Inter-systèmes"
158 self.children.append(modules.AppList(
159 _(u'Inter-systèmes'),
160 models=(
fc4bf968 161 'project.rh.models.ResponsableImplantation',
7f43054e
PP
162 ),
163 ))