如何在Django CMS3和我的应用程序中集成菜单?(How to integrate a menu in Django CMS3 and my app?)

编程入门 行业动态 更新时间:2024-10-26 14:34:17
如何在Django CMS3和我的应用程序中集成菜单?(How to integrate a menu in Django CMS3 and my app?)

我在使用Django CMS 3设置菜单时遇到问题。

我确实向cms添加了这样的页面:

Home Teachers (id teachers) Contact Info

现在我可以只为这样的“老师”添加我的菜单(在我的老师/ templates / teachers_index.html中):

{% show_menu_below_id "teachers" 0 100 100 100 %}

在主项目的urls.py中,我有这一行,所以我添加了教师应用程序中的所有网址:

url(r'^teachers/', include('myapp.apps.teachers.urls', namespace='teachers')),

在myapp.app.teachers.urls中:

url(r'^$', views.index, name='index')

现在我认为所有基本上都设置了,但它不是:(

我认为一个网址:教师/联系人现在会去教师应用程序,但事实并非如此。 它只是加载主应用程序模板而不是教师应用程序中的模板。

所以我想我必须以某种方式将CMS连接到教师应用程序? 但我真的没有任何线索。 我希望我的问题很清楚,有人可以指出我正确的方向吗?

I have trouble setting up my menu with Django CMS 3.

I did add pages to the cms like this:

Home Teachers (id teachers) Contact Info

Now i can add my menu for only "teachers" like this (in my teachers/templates/teachers_index.html):

{% show_menu_below_id "teachers" 0 100 100 100 %}

In my urls.py from the main project, I have this line, so I add all the urls from the teachers app:

url(r'^teachers/', include('myapp.apps.teachers.urls', namespace='teachers')),

And in myapp.app.teachers.urls:

url(r'^$', views.index, name='index')

Now i would think all was basically set, but it is not :(

I thought an url like: teachers/contact would now go to the teachers app, but it is not. It just loads the main app template and not the one from the teachers app.

So i think i have to connect the CMS somehow to the teachers app? But i realy have no clue at all. I hope my question is clear and that someone can point me in the right direction?

最满意答案

好的,再次感到愚蠢......以下是如何做到的:

在设置中添加模板:

CMS_TEMPLATES = ( ('three_columns.html', 'Three columns'), #default one ('teachers_index.html', 'Three columns teachers'), #new one )

然后在CMS中:编辑页面>高级设置>选择模板:)

Ok, feeling stupid again... Here is how to do it:

In settings add the template:

CMS_TEMPLATES = ( ('three_columns.html', 'Three columns'), #default one ('teachers_index.html', 'Three columns teachers'), #new one )

and then in the CMS: edit page > advanced settings > choose template :)

更多推荐

本文发布于:2023-08-01 10:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1357757.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   菜单   如何在   Django   app

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!