From 2d16a57b244b04e79695bce28b496644a5b142c1 Mon Sep 17 00:00:00 2001 From: Stefan Lendl Date: Mon, 4 Oct 2021 16:25:56 +0200 Subject: [PATCH] directly selecting a node with submenu A -> A.1 -> A.2 Selecting a menu item with a submenu (A) will always call _process_breadcrums() on all submenu items (A.1, A.2) If non of the submenu items is selected, the parent node is also not selected. Selecting A.1 will work and select A. Directly selecting A will not mark A as selcted, as neither A.1 nor A.2 are selected. fixes https://github.com/LaLogiaDePython/django-menu-generator/issues/16 --- menu_generator/menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu_generator/menu.py b/menu_generator/menu.py index 276d76e..5ed8ece 100755 --- a/menu_generator/menu.py +++ b/menu_generator/menu.py @@ -114,7 +114,7 @@ def _process_breadcrums(self, menu_list): can be used as breadcrumbs """ for item in menu_list: - if item['submenu']: + if not item['selected'] and item['submenu']: item['selected'] = self._process_breadcrums(item['submenu']) if item['selected']: return True