powderflask
unread,Nov 9, 2010, 8:12:50 PM11/9/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-cms-developers
cms template tags provide a very flexible way of referencing a page -
the page_lookup parameter, which can be a Page, the page's pk, or its
"reverse_id" string.
But, menu template tags permit only the "reverse_id" string to specify
the root node for a menu.
This limitation causes a problem in the following use-case:
- I have a small plugin that provides a content provider access to
the show_menu... template tags;
- this plugin allows a user to configure a navigation menu and add it
to any placeholder;
- to display a "section" navigation for nodes below a section root
page on the site, the user simply selects the page that forms the
section root;
- however, since the menu tags only permit the use of a reverse_id,
the user must also add an id for any pages that will form navigation
roots so that the root node can be specified to the tag. Confusing.
On inspecting the code, it seems it should be possible to add the
flexibility of the "page_lookup" functionality to the menu tags
without compromising the menu modules independence - it would be a
"node_lookup", and could be a node id, a "reverse_id" string, or any
object with the same pk as the required node's id.
This strategy hinges on the fact that the menu node id is identical to
the Page object's pk, which appears to be the case.
I am willing to code up a proposal, but wanted to ask first for
advice. Perhaps there is a good reason why this approach won't
work? Or maybe I'm totally missing something and there is already a
way to do this?
Many thanks for any advice.