Django cms menu template
However, you would like to integrate the application into the menu structure of your site, so that at appropriate places a News node appears in the navigation menu. In another example, you might want a particular attribute of your Pages to be available in menu templates.
In order to keep menu nodes lightweight which can be important in a site with thousands of pages they only contain the minimum attributes required to generate a usable menu. In both cases, a Navigation Modifier is the solution - in the first case, to add a new node at the appropriate place, and in the second, to add a new attribute - on the attr attribute, rather than directly on the NavigationNode , to help avoid conflicts - to all nodes in the menu.
To make your modifier available, it then needs to be registered with menus. Now, when a page is loaded and the menu generated, your modifier will be able to inspect and modify its nodes.
It has a method modify that should return a list of NavigationNode instances. Menus : Statically extend the menu entries Attach Menus : Attach your menu to a page.
Note Up to version 3. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 10 years, 5 months ago. Active 6 years, 5 months ago. Viewed 9k times. Can anyone supply me a sample of customizing the django-cms menu template, please? Antony Hatchkins Add a comment. Active Oldest Votes. Please note that menus live in the menus application, which though tightly coupled to the cms application exists independently of it.
Menus are usable by any application, not just by django CMS. If you have home as a root node i. The fifth parameter, namespace specifies the namespace of the menu. You can supply a template parameter to the tag. If you have set an id in the advanced settings of a page, you can display the sub-menu of this page with a template tag. Show the breadcrumb navigation of the current page. Usually, only pages visible in the navigation are shown in the breadcrumb.
To include all pages in the breadcrumb, write:. If the current URL is not handled by the CMS or by a navigation extender, the current menu node can not be determined.
0コメント