1 # -*- coding: utf-8 -*-
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.
7 To activate your custom menu add the following to your settings.py::
8 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
11 from django
.core
.urlresolvers
import reverse
12 from django
.utils
.translation
import ugettext_lazy
as _
14 from admin_tools
.menu
import items
, Menu
15 from project
.rh
.groups
import grp_drh
17 class CustomMenu(Menu
):
19 Custom Menu for project admin site.
21 def __init__(self
, **kwargs
):
22 Menu
.__init__(self
, **kwargs
)
24 items
.MenuItem(_('Dashboard'), reverse('admin:index')),
28 exclude
=('django.contrib.*',)
32 models
=('django.contrib.*',)
36 def init_with_context(self
, context
):
38 Use this method if you need to access the request context.
40 request
= context
['request']
41 if grp_drh
in request
.user
.groups
.all() or request
.user
.is_superuser
:
43 items
.MenuItem('Rapports',
45 items
.MenuItem('Rapport des postes', reverse('rhr_postes')),
46 items
.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
47 items
.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')),
51 super(CustomMenu
, self
).init_with_context(context
)