开发者

Is it possible to show Django-CMS menus in a non-CMS application?

开发者 https://www.devze.com 2023-02-07 05:14 出处:网络
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

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 开发者_Python百科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.


There is a template tag for that: show_menu_below_id


To further quote:

Note

All views that are attached like this must return a RequestContext instance instead of the default Context instance.

I just had to add context_instance=RequestContext(request) to my render_to_responses.

0

精彩评论

暂无评论...
验证码 换一张
取 消