Skip to content

Way to get selected Menu (not MenuItem) from context #151

Open
@danilo-botelho

Description

@danilo-botelho

Hi, there!

The generate_menu templatetag adds menus and selected_menu to the template context:

simple_menu/templatetags/simple_menu.py

# set the items in our context
context['menus'] = menus
context['selected_menu'] = selected_menu
context['submenu'] = submenu
context['has_submenu'] = has_submenu

Although menus contain a dictionary with MenuItems grouped by their "menu name" (class Menu) submenu will point to the selected MenuItem (despite its name suggests class Menu).

How can I display only the selected menu when there seems to be no pointer to it?

Probably if we could change the template tag simply to add a reference to menus[name] of the selected_menuitem. (And maybe use selected_menu for that and selected_menuitem for what is currently pointed by selected_menu).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions