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