import users
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / menu.py
CommitLineData
9c29b8d4
EMS
1# coding: utf-8
2
3from django.core.urlresolvers import reverse
4from django.utils.translation import ugettext_lazy as _
5from admin_tools.menu import items, Menu
6
7class CustomMenu(Menu):
8 """
9 Custom Menu for sep admin site.
10 """
1c65da27
OL
11
12 statistiques = items.MenuItem(title='Statistiques', url=reverse('stats'))
13
9c29b8d4
EMS
14 def __init__(self, **kwargs):
15 Menu.__init__(self, **kwargs)
16 self.children.append(items.MenuItem(
17 title=_('Dashboard'),
18 url=reverse('admin:index')
19 ))
20 self.children.append(items.AppList(
21 title=_('Applications'),
22 exclude_list=('django.contrib',)
23 ))
24 self.children.append(items.AppList(
25 title=_('Administration'),
26 include_list=('django.contrib',)
27 ))
9c29b8d4
EMS
28
29 def init_with_context(self, context):
30 """
31 Use this method if you need to access the request context.
32 """
1c65da27
OL
33 request = context['request']
34 if request.user.has_perm('savoirs.statistiques'):
35 self.children.append(self.statistiques)