Skip to content

Instantly share code, notes, and snippets.

@enagorny
Created May 15, 2012 08:11
Show Gist options
  • Save enagorny/2699940 to your computer and use it in GitHub Desktop.
Save enagorny/2699940 to your computer and use it in GitHub Desktop.
from menus.base import Modifier
from menus.menu_pool import menu_pool
from cms.models import Page
class JustMenu(Modifier):
"""
Menu modifier that add to node template name of the node page
used to make some page in the menu, just menu items with no links.
"""
post_cut = False
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
tpls = dict(Page.objects.filter(id__in=[x.id for x in nodes]).values_list('id', 'template'))
for node in nodes:
node.tpl = tpls[node.id]
return nodes
menu_pool.register_modifier(JustMenu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment