Préparation pour nouveau QBE
[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 django.utils.translation import ugettext_lazy as _
16 from django.core.urlresolvers import reverse
17
18 from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
19 from admin_tools.utils import get_admin_site_name
20
21
22 class 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'),
32 models=(
33 'project.dae.models.*',
34 'project.recrutement.models.*',
35 'project.rh.models.AyantDroit',
36 'project.rh.models.Dossier',
37 'project.rh.models.DossierInactif',
38 'project.rh.models.Employe',
39 'project.rh.models.EmployeInactif',
40 'project.rh.models.Poste',
41 'django_qbe.models.*',
42 ),
43 ))
44
45 # append an app list module for "Configuration"
46 self.children.append(modules.AppList(
47 _('Configuration'),
48 models=(
49 'project.rh.models.Classement',
50 'project.rh.models.Devise',
51 'project.rh.models.FamilleEmploi',
52 'project.rh.models.OrganismeBstg',
53 'project.rh.models.Responsable',
54 'project.rh.models.Service',
55 'project.rh.models.Statut',
56 'project.rh.models.TauxChange',
57 'project.rh.models.TypeContrat',
58 'project.rh.models.TypePoste',
59 'project.rh.models.TypeRevalorisation',
60 'project.rh.models.TypeRemuneration',
61 'project.rh.models.ValeurPoint',
62 ),
63 exclude=('django.contrib.*',),
64 ))
65
66 # append an app list module for "Inter-systèmes"
67 self.children.append(modules.AppList(
68 _(u'Inter-systèmes'),
69 models=(
70 'project.rh.models.ResponsableImplantation',
71 ),
72 ))
73
74 # append an app list module for "Administration"
75 self.children.append(modules.AppList(
76 _('Administration'),
77 models=(
78 'django.contrib.*',
79 ),
80 ))
81
82 # append a recent actions module
83 #self.children.append(modules.RecentActions(_('Recent Actions'), 5))
84
85
86 class CustomAppIndexDashboard(AppIndexDashboard):
87 """
88 Custom app index dashboard for project.
89 """
90
91 # we disable title because its redundant with the model list module
92 title = ''
93
94 def __init__(self, *args, **kwargs):
95 AppIndexDashboard.__init__(self, *args, **kwargs)
96
97 def init_with_context(self, context):
98 """
99 Use this method if you need to access the request context.
100 """
101 if self.app_title != 'Rh':
102 # append a model list module and a recent actions module
103 self.children += [
104 modules.ModelList(self.app_title,self.models),
105 #modules.RecentActions(
106 # _('Recent Actions'),
107 # include_list=self.get_app_content_types(),
108 # limit=5
109 #)
110 ]
111
112 return
113
114 # append an app list module for "Application"
115 self.children.append(modules.AppList(
116 _('Application'),
117 models=(
118 'project.rh.models.AyantDroit',
119 'project.rh.models.Dossier',
120 'project.rh.models.DossierInactif',
121 'project.rh.models.Employe',
122 'project.rh.models.EmployeInactif',
123 'project.rh.models.Poste',
124 ),
125 ))
126
127 # append an app list module for "Configuration"
128 self.children.append(modules.AppList(
129 _('Configuration'),
130 models=(
131 'project.rh.models.Classement',
132 'project.rh.models.Devise',
133 'project.rh.models.FamilleEmploi',
134 'project.rh.models.OrganismeBstg',
135 'project.rh.models.Responsable',
136 'project.rh.models.Service',
137 'project.rh.models.Statut',
138 'project.rh.models.TauxChange',
139 'project.rh.models.TypeContrat',
140 'project.rh.models.TypePoste',
141 'project.rh.models.TypeRevalorisation',
142 'project.rh.models.TypeRemuneration',
143 'project.rh.models.ValeurPoint',
144 ),
145 ))
146
147 # append an app list module for "Inter-systèmes"
148 self.children.append(modules.AppList(
149 _(u'Inter-systèmes'),
150 models=(
151 'project.rh.models.ResponsableImplantation',
152 ),
153 ))
154
155 # append a recent actions module
156 #self.children.append(modules.RecentActions(
157 # _('Recent Actions'),
158 # include_list=self.get_app_content_types(),
159 # limit=5
160 #))