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 | 17 | |
8846b99e OL |
18 | class CustomIndexDashboard(Dashboard): |
19 | """ | |
20 | Custom index dashboard for SIGMA. | |
21 | """ | |
22 | def init_with_context(self, context): | |
8846b99e OL |
23 | |
24 | # append an app list module for "Applications" | |
25 | self.children.append(modules.AppList( | |
26 | _('Applications'), | |
d69f7f42 | 27 | models=( |
fc4bf968 EMS |
28 | 'project.dae.models.*', |
29 | 'project.recrutement.models.*', | |
30 | 'project.rh.models.AyantDroit', | |
31 | 'project.rh.models.Dossier', | |
32 | 'project.rh.models.DossierInactif', | |
33 | 'project.rh.models.Employe', | |
34 | 'project.rh.models.EmployeInactif', | |
35 | 'project.rh.models.Poste', | |
d69f7f42 DB |
36 | ), |
37 | )) | |
38 | ||
39 | # append an app list module for "Configuration" | |
40 | self.children.append(modules.AppList( | |
41 | _('Configuration'), | |
42 | models=( | |
fc4bf968 EMS |
43 | 'project.rh.models.Classement', |
44 | 'project.rh.models.Devise', | |
45 | 'project.rh.models.CategorieEmploi', | |
321fe481 | 46 | 'project.rh.models.FamilleProfessionnelle', |
fc4bf968 EMS |
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', | |
56fdab08 | 57 | ), |
8846b99e OL |
58 | exclude=('django.contrib.*',), |
59 | )) | |
60 | ||
d69f7f42 DB |
61 | # append an app list module for "Inter-systèmes" |
62 | self.children.append(modules.AppList( | |
63 | _(u'Inter-systèmes'), | |
64 | models=( | |
6fb68b2f | 65 | 'project.rh.models.ResponsableImplantationProxy', |
d69f7f42 DB |
66 | ), |
67 | )) | |
68 | ||
8846b99e OL |
69 | # append an app list module for "Administration" |
70 | self.children.append(modules.AppList( | |
71 | _('Administration'), | |
d69f7f42 | 72 | models=( |
fc4bf968 | 73 | 'django.contrib.*', |
d69f7f42 | 74 | ), |
8846b99e OL |
75 | )) |
76 | ||
7f43054e PP |
77 | class CustomAppIndexDashboard(AppIndexDashboard): |
78 | """ | |
79 | Custom app index dashboard for project. | |
80 | """ | |
81 | ||
82 | # we disable title because its redundant with the model list module | |
83 | title = '' | |
84 | ||
85 | def __init__(self, *args, **kwargs): | |
86 | AppIndexDashboard.__init__(self, *args, **kwargs) | |
87 | ||
88 | def init_with_context(self, context): | |
89 | """ | |
90 | Use this method if you need to access the request context. | |
91 | """ | |
92 | if self.app_title != 'Rh': | |
93 | # append a model list module and a recent actions module | |
94 | self.children += [ | |
fc4bf968 | 95 | modules.ModelList(self.app_title, self.models), |
7f43054e PP |
96 | ] |
97 | ||
98 | return | |
99 | ||
100 | # append an app list module for "Application" | |
101 | self.children.append(modules.AppList( | |
102 | _('Application'), | |
103 | models=( | |
fc4bf968 EMS |
104 | 'project.rh.models.AyantDroit', |
105 | 'project.rh.models.Dossier', | |
106 | 'project.rh.models.DossierInactif', | |
107 | 'project.rh.models.Employe', | |
108 | 'project.rh.models.EmployeInactif', | |
109 | 'project.rh.models.Poste', | |
7f43054e PP |
110 | ), |
111 | )) | |
112 | ||
113 | # append an app list module for "Configuration" | |
114 | self.children.append(modules.AppList( | |
115 | _('Configuration'), | |
116 | models=( | |
fc4bf968 EMS |
117 | 'project.rh.models.Classement', |
118 | 'project.rh.models.Devise', | |
119 | 'project.rh.models.CategorieEmploi', | |
321fe481 | 120 | 'project.rh.models.FamilleProfessionnelle', |
fc4bf968 EMS |
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', | |
7f43054e PP |
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=( | |
fc4bf968 | 138 | 'project.rh.models.ResponsableImplantation', |
7f43054e PP |
139 | ), |
140 | )) |