[#3262] Mettre de l'ordre dans le dashboard
[auf_rh_dae.git] / project / dashboard.py
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 admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
16 from django.utils.translation import ugettext_lazy as _
17
18 class CustomIndexDashboard(Dashboard):
19 """
20 Custom index dashboard for SGRH.
21 """
22 def init_with_context(self, context):
23
24 # append an app list module for "Applications"
25 self.children.append(modules.Group(
26 _('Applications'),
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 ]
60 ))
61
62 # append an app list module for "Configuration"
63 self.children.append(modules.AppList(
64 _('Configuration'),
65 models=(
66 'project.rh.models.Classement',
67 'project.rh.models.Devise',
68 'project.rh.models.CategorieEmploi',
69 'project.rh.models.FamilleProfessionnelle',
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',
80 ),
81 exclude=('django.contrib.*',),
82 ))
83
84 # append an app list module for "Inter-systèmes"
85 self.children.append(modules.AppList(
86 _(u'Inter-systèmes'),
87 models=(
88 'project.rh.models.ResponsableImplantation',
89 ),
90 ))
91
92 # append an app list module for "Administration"
93 self.children.append(modules.AppList(
94 _('Administration'),
95 models=(
96 'django.contrib.*',
97 ),
98 ))
99
100 class 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 += [
118 modules.ModelList(self.app_title, self.models),
119 ]
120
121 return
122
123 # append an app list module for "Application"
124 self.children.append(modules.AppList(
125 _('Application'),
126 models=(
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',
133 ),
134 ))
135
136 # append an app list module for "Configuration"
137 self.children.append(modules.AppList(
138 _('Configuration'),
139 models=(
140 'project.rh.models.Classement',
141 'project.rh.models.Devise',
142 'project.rh.models.CategorieEmploi',
143 'project.rh.models.FamilleProfessionnelle',
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',
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=(
161 'project.rh.models.ResponsableImplantation',
162 ),
163 ))