[#3262] Mettre de l'ordre dans le dashboard
[auf_rh_dae.git] / project / menu.py
1 # -*- coding: utf-8 -*-
2
3 """
4 This file was generated with the custommenu management command, it contains
5 the classes for the admin menu, you can customize this class as you want.
6
7 To activate your custom menu add the following to your settings.py::
8 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
9 """
10
11 from django.core.urlresolvers import reverse
12 from django.utils.translation import ugettext_lazy as _
13
14 from admin_tools.menu import items, Menu
15
16 from project.decorators import in_drh_or_admin
17
18 class CustomMenu(Menu):
19 """
20 Custom Menu for project admin site.
21 """
22 def __init__(self, **kwargs):
23 Menu.__init__(self, **kwargs)
24 self.children += [
25 items.MenuItem(_('Dashboard'), reverse('admin:index')),
26 #items.Bookmarks(),
27 items.AppList(
28 _('Applications'),
29 exclude=('django.contrib.*', 'project.rh.models.EmployeProxy')
30 ),
31 items.AppList(
32 _('Administration'),
33 models=('django.contrib.*',)
34 )
35 ]
36
37 def init_with_context(self, context):
38 """
39 Use this method if you need to access the request context.
40 """
41 request = context['request']
42 if in_drh_or_admin(request.user):
43 self.children += [
44 items.MenuItem('Rapports',
45 children=[
46 #items.MenuItem('Rapport des postes', reverse('rhr_postes')),
47 items.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
48 items.MenuItem(u'Rapport des employés sans contrat', reverse('rhr_employe_sans_contrat')),
49 #items.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')),
50
51 # A corriger
52 #items.MenuItem('Rapport des postes par service', reverse('rhr_postes_service')),
53 #items.MenuItem('Rapport des postes par implantation', reverse('rhr_postes_implantation')),
54
55 #items.MenuItem('Modelisation des postes', reverse('rhr_postes_modelisation')),
56 #items.MenuItem('Rapport hiérarchique des postes', reverse('rhr_postes_hierarchie')),
57 items.MenuItem('Rapport de masse salariale', reverse('rhr_masse_salariale')),
58 ]
59 ),
60 items.MenuItem('Organigrammes',
61 children=[
62 items.MenuItem('Organigramme par employé', reverse('admin:rh_employeproxy_changelist')),
63 items.MenuItem('Organigramme par service', reverse('admin:rh_serviceproxy_changelist')),
64 items.MenuItem('Organigramme par implantation', reverse('admin:rh_implantationproxy_changelist')),
65 items.MenuItem('Organigramme par bureau', reverse('admin:rh_regionproxy_changelist')),
66 ]
67 ),
68 items.MenuItem('Requêtes',
69 children=[
70 items.MenuItem('Requêtes sauvegardées', reverse('admin:django_qbe_savedquery_changelist')),
71 items.MenuItem('Constructeur de requêtes', reverse('qbe_form')),
72 ]
73 ),
74 ]
75 super(CustomMenu, self).init_with_context(context)
76