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