是否可以在非 CMS 应用程序中显示 Django-CMS 菜单?
在 Django 项目中,我有 Django-CMS 和另一个应用程序(我们称之为“应用程序 B”)。我希望这两个应用程序都有一组一致的菜单。我已使用 menu_pool.register_menu
添加了新项目。 此页面说
请注意,菜单最初是独立于应用程序实现的,因此位于菜单应用程序中,而不是“普通”cms
,因此我希望我可以在“应用程序 B”的模板中编写与内容管理系统。我的“App B”模板和 CMS 模板中都有这个:
<ul>{% show_menu 0 100 0 1 %}</ul>
在 CMS 中它可以工作,显示完整的菜单。在“App B”中,它只是呈现空白:
<ul></ul>
除非必须,否则我不想创建插件或应用程序挂钩。我必须这样做吗?
编辑:我已经用 App-Hook 尝试过,但它仍然不起作用。
In Django project I have Django-CMS and another application (let's call it "App B"). I want a consistent set of menus across both apps. I have added the new items with menu_pool.register_menu
. This page says
Please note that menus were originally implemented to be application-independant and as such, live in the menus application instead of the “normal” cms
so I would expect that I can write the same menu tag in the template for "App B" as for CMS. I have this in both my "App B" template and my CMS template:
<ul>{% show_menu 0 100 0 1 %}</ul>
In the CMS it works, showing the full menu. In "App B" it just renders blank:
<ul></ul>
I don't want to have to create a plugin or app hook unless I have to. Do I have to?
EDIT: I have tried this with an App-Hook and it still doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个模板标签: show_menu_below_id
There is a template tag for that: show_menu_below_id
进一步引用:
我只需将
context_instance=RequestContext(request)
添加到我的render_to_response
中。To further quote:
I just had to add
context_instance=RequestContext(request)
to myrender_to_response
s.