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