Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MENU_SELECT_PARENTS selects multiple as active #75

Open
nikolas-dev opened this issue Dec 31, 2021 · 2 comments
Open

MENU_SELECT_PARENTS selects multiple as active #75

nikolas-dev opened this issue Dec 31, 2021 · 2 comments
Assignees
Labels
bug Something doesn't work the way it should

Comments

@nikolas-dev
Copy link

I've select submenu of an item. But it selects top most parents and selects anothers what I've selected. Just like below.

image

How to fix the issue

@kytta kytta added the bug Something doesn't work the way it should label May 31, 2022
@kytta
Copy link
Member

kytta commented May 31, 2022

Hi! Could you provide us with some bits of your source code? I'm most interested in menus.py and the template files, where you iterate over menu

@kytta kytta self-assigned this May 31, 2022
@ctrl-alt-d
Copy link

Same issue here, I solved it adding exact_url=True, to all menu items.

I think the issue is due to how django-simple-menu is checking whether the current URL belongs to the menu item or not:

def match_url(self, request):
"""
match url determines if this is selected
"""
matched = False
if self.exact_url:
if re.match(f"{self.url}$", request.path):
matched = True
elif re.match("%s" % self.url, request.path):
matched = True
return matched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something doesn't work the way it should
Projects
None yet
Development

No branches or pull requests

3 participants