Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Newly created instances of NavigationNode doesn't have important attributes #907

neoascetic opened this Issue · 5 comments

4 participants


From that thread:

Hi all.
After an app integration I'm try to extend menu (with specified ID) with links to views of my app. I'm use for this Navigation Modifiers.
Here code of

from menus.base import Modifier, NavigationNode
from menus.menu_pool import menu_pool

class MyNode(Modifier):
        name = 'mymenu'
        def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
                if post_cut: return nodes
                if root_id == 'top_menu':
                        nodes.append(NavigationNode('test', '/', 1))
                return nodes


from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from import MyNode

from django.utils.translation import ugettext_lazy as _

class StandardProjectsApp(CMSApp):
        name = _('Standard projects')
        urls = ['standard_projects.urls']
        menu = [MyNode]


And when I try access a page with this menu, django crash with Error:
Caught AttributeError while rendering: 'NavigationNode' object has no attribute 'selected'

When I try to print dir(nodes[0]) in modify function of MyMenu, it's show NavigationNodes with this attribute, but when I try do this with my newly created node, it doesn't have this attribute.
What I'm doing wrong? Maybe here another ways to extend menu with specified ID?


Now you're doing a thing here that was never intended to be done, adding navigation nodes in modifiers. Modifiers should just alter existing navigation nodes, while navigation nodes should be attached using Menu/CMSAttachMenu subclasses.

Therefore I'll close this as a WONTFIX for now

@ojii ojii closed this

Note that while it may not have been intended to be done, the documentation has always been rather ambiguous - it talked of adding and changing properties, but those without a keen understanding of the underlying intention may not have understood that correctly.

However, in the develop docs it now explicitly says that adding navigation nodes via a modifier is OK. I wonder: Is that intentional (and a change in stance) or an error in the updated docs?

@ojii ojii reopened this

This might indeed be a documentation issue

@ojii ojii closed this issue from a commit
@ojii ojii Fixed #907 f7757f4
@ojii ojii closed this in f7757f4

I too fell into this documentation trap on latest.

While this f7757f4 says it can change existing, the docs implies Modifier can be used to add new nodes as well or at least it's not explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.