Commit | Line | Data |
---|---|---|
6f38ca31 PP |
1 | """ |
2 | This file was generated with the custommenu management command, it contains | |
3 | the classes for the admin menu, you can customize this class as you want. | |
4 | ||
5 | To activate your custom menu add the following to your settings.py:: | |
6 | ADMIN_TOOLS_MENU = 'project.menu.CustomMenu' | |
7 | """ | |
8 | ||
9 | from django.core.urlresolvers import reverse | |
10 | from django.utils.translation import ugettext_lazy as _ | |
11 | ||
12 | from admin_tools.menu import items, Menu | |
13 | ||
14 | ||
15 | class CustomMenu(Menu): | |
16 | """ | |
17 | Custom Menu for project admin site. | |
18 | """ | |
19 | def __init__(self, **kwargs): | |
20 | Menu.__init__(self, **kwargs) | |
21 | self.children += [ | |
22 | items.MenuItem(_('Dashboard'), reverse('admin:index')), | |
23 | items.Bookmarks(), | |
24 | items.AppList( | |
25 | _('Applications'), | |
26 | exclude=('django.contrib.*',) | |
27 | ), | |
28 | items.MenuItem('Rapports', | |
29 | children=[ | |
30 | items.MenuItem('Rapport des postes', reverse('rhr_postes')), | |
31 | items.MenuItem('Rapport des contrats', reverse('rhr_contrats')), | |
32 | ] | |
33 | ), | |
34 | items.AppList( | |
35 | _('Administration'), | |
36 | models=('django.contrib.*',) | |
37 | ) | |
38 | ] | |
39 | ||
40 | def init_with_context(self, context): | |
41 | """ | |
42 | Use this method if you need to access the request context. | |
43 | """ | |
44 | return super(CustomMenu, self).init_with_context(context) |