From 48d40eefa633281f9c6f545f4b74902b721c4904 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Mon, 3 Jul 2017 17:49:40 +0200 Subject: [PATCH] trans_title optional --- publichealth/home/templatetags/navigation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py index a3c9c22..78e1ebd 100644 --- a/publichealth/home/templatetags/navigation.py +++ b/publichealth/home/templatetags/navigation.py @@ -39,8 +39,10 @@ def top_menu(context, parent, calling_page=None): menuitem.show_dropdown = has_menu_children(menuitem) menuitem.active = (calling_page.url.startswith(menuitem.url) if calling_page else False) - if 'trans_title' in menuitem: + try: menuitem.title = menuitem.trans_title + except AttributeError: + pass return { 'calling_page': calling_page, 'menuitems': menuitems, @@ -50,8 +52,10 @@ def top_menu(context, parent, calling_page=None): def menuitems_children(parent): menuitems_children = parent.get_children().live().in_menu().specific() for menuitem in menuitems_children: - if 'trans_title' in menuitem: + try: menuitem.title = menuitem.trans_title + except AttributeError: + pass return menuitems_children # Retrieves the children of the top menu items for the drop downs