PEP8
[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
19 class CustomIndexDashboard(Dashboard):
20 """
21 Custom index dashboard for SIGMA.
22 """
23 def init_with_context(self, context):
24
25 # append an app list module for "Applications"
26 self.children.append(modules.AppList(
27 _('Applications'),
28 models=(
29 'project.dae.models.*',
30 'project.recrutement.models.*',
31 'project.rh.models.AyantDroit',
32 'project.rh.models.Dossier',
33 'project.rh.models.DossierInactif',
34 'project.rh.models.Employe',
35 'project.rh.models.EmployeInactif',
36 'project.rh.models.Poste',
37 ),
38 ))
39
40 # append an app list module for "Configuration"
41 self.children.append(modules.AppList(
42 _('Configuration'),
43 models=(
44 'project.rh.models.Classement',
45 'project.rh.models.Devise',
46 'project.rh.models.CategorieEmploi',
47 'project.rh.models.OrganismeBstg',
48 'project.rh.models.Responsable',
49 'project.rh.models.Service',
50 'project.rh.models.Statut',
51 'project.rh.models.TauxChange',
52 'project.rh.models.TypeContrat',
53 'project.rh.models.TypePoste',
54 'project.rh.models.TypeRevalorisation',
55 'project.rh.models.TypeRemuneration',
56 'project.rh.models.ValeurPoint',
57 ),
58 exclude=('django.contrib.*',),
59 ))
60
61 # append an app list module for "Inter-systèmes"
62 self.children.append(modules.AppList(
63 _(u'Inter-systèmes'),
64 models=(
65 'project.rh.models.ResponsableImplantation',
66 ),
67 ))
68
69 # append an app list module for "Administration"
70 self.children.append(modules.AppList(
71 _('Administration'),
72 models=(
73 'django.contrib.*',
74 ),
75 ))
76
77
78 class CustomAppIndexDashboard(AppIndexDashboard):
79 """
80 Custom app index dashboard for project.
81 """
82
83 # we disable title because its redundant with the model list module
84 title = ''
85
86 def __init__(self, *args, **kwargs):
87 AppIndexDashboard.__init__(self, *args, **kwargs)
88
89 def init_with_context(self, context):
90 """
91 Use this method if you need to access the request context.
92 """
93 if self.app_title != 'Rh':
94 # append a model list module and a recent actions module
95 self.children += [
96 modules.ModelList(self.app_title, self.models),
97 ]
98
99 return
100
101 # append an app list module for "Application"
102 self.children.append(modules.AppList(
103 _('Application'),
104 models=(
105 'project.rh.models.AyantDroit',
106 'project.rh.models.Dossier',
107 'project.rh.models.DossierInactif',
108 'project.rh.models.Employe',
109 'project.rh.models.EmployeInactif',
110 'project.rh.models.Poste',
111 ),
112 ))
113
114 # append an app list module for "Configuration"
115 self.children.append(modules.AppList(
116 _('Configuration'),
117 models=(
118 'project.rh.models.Classement',
119 'project.rh.models.Devise',
120 'project.rh.models.CategorieEmploi',
121 'project.rh.models.OrganismeBstg',
122 'project.rh.models.Responsable',
123 'project.rh.models.Service',
124 'project.rh.models.Statut',
125 'project.rh.models.TauxChange',
126 'project.rh.models.TypeContrat',
127 'project.rh.models.TypePoste',
128 'project.rh.models.TypeRevalorisation',
129 'project.rh.models.TypeRemuneration',
130 'project.rh.models.ValeurPoint',
131 ),
132 ))
133
134 # append an app list module for "Inter-systèmes"
135 self.children.append(modules.AppList(
136 _(u'Inter-systèmes'),
137 models=(
138 'project.rh.models.ResponsableImplantation',
139 ),
140 ))