From 6f38ca3119091ef17f017a90db7159f22360cab1 Mon Sep 17 00:00:00 2001 From: PA Parent Date: Tue, 13 Dec 2011 10:42:32 -0500 Subject: [PATCH] Ajout d'un menu, et correction des liens du breadcrumbs --- project/menu.py | 44 ++++++++++++++++++++++++++++ project/rh/templates/rh/rapports/base.html | 4 +-- project/settings.py | 1 + 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 project/menu.py diff --git a/project/menu.py b/project/menu.py new file mode 100644 index 0000000..db73ace --- /dev/null +++ b/project/menu.py @@ -0,0 +1,44 @@ +""" +This file was generated with the custommenu management command, it contains +the classes for the admin menu, you can customize this class as you want. + +To activate your custom menu add the following to your settings.py:: + ADMIN_TOOLS_MENU = 'project.menu.CustomMenu' +""" + +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ + +from admin_tools.menu import items, Menu + + +class CustomMenu(Menu): + """ + Custom Menu for project admin site. + """ + def __init__(self, **kwargs): + Menu.__init__(self, **kwargs) + self.children += [ + items.MenuItem(_('Dashboard'), reverse('admin:index')), + items.Bookmarks(), + items.AppList( + _('Applications'), + exclude=('django.contrib.*',) + ), + items.MenuItem('Rapports', + children=[ + items.MenuItem('Rapport des postes', reverse('rhr_postes')), + items.MenuItem('Rapport des contrats', reverse('rhr_contrats')), + ] + ), + items.AppList( + _('Administration'), + models=('django.contrib.*',) + ) + ] + + def init_with_context(self, context): + """ + Use this method if you need to access the request context. + """ + return super(CustomMenu, self).init_with_context(context) diff --git a/project/rh/templates/rh/rapports/base.html b/project/rh/templates/rh/rapports/base.html index 3ad3388..cc42093 100644 --- a/project/rh/templates/rh/rapports/base.html +++ b/project/rh/templates/rh/rapports/base.html @@ -10,8 +10,8 @@ {% block breadcrumbs %}{% if not is_popup %} {% endif %}{% endblock %} diff --git a/project/settings.py b/project/settings.py index f302ef6..ce54083 100644 --- a/project/settings.py +++ b/project/settings.py @@ -112,6 +112,7 @@ TEMPLATE_DIRS = ( ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard' ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard' +ADMIN_TOOLS_MENU = 'project.menu.CustomMenu' AJAX_LOOKUP_CHANNELS = { 'responsables' : ('dae.catalogues', 'Responsable'), -- 1.7.10.4