the*_*eld 7 django templates django-cms mezzanine
我一直在玩夹层楼几天,我一直在关注这个博客,这非常有帮助.
我现在正处于需要制作一堆需要基于自定义模板的页面的位置.我的自定义模板被调用content.html
我把它放进去myProject > myApp/theme folder > templates > pages > content.html但是当我查看管理控制台时,我没有在下拉菜单中看到内容.
如何让夹层识别我的content.html页面作为模板?
content.html 不会自动出现在您网站的下拉菜单中。
您需要转到管理站点并显式声明一个页面my content,该页面content.html要出现在页面层次结构中。
为了使夹层匹配两者(即模板content.html和管理页面my content):
my content的标题字段(管理网站)应该是content, my content)应为content(如果您决定标题为content),或者,如果您想要content.html一个自定义的标签,请说nicecontent,然后用匹配的标签填充URL字段nicecontent并为其添加url.py一个模式content.html,因此:
url("^nicecontent/$", direct_to_template, {"template": "path/to/content.html"}, name="name_for_content").
Run Code Online (Sandbox Code Playgroud)Mezzanine 使用一种方法来查找模板名称,从最广泛的(“page.html”,所有其他模板也扩展),到根据其内容类型命名的模板(richtextpage.html、gallery.html 等),再到最细粒度的级别,是与各个页面的 url/slug 匹配的模板。
文档中涵盖了所有这些:
http://mezzanine.jupo.org/docs/content-architecture.html#page-templates
听起来您可能正在寻找“page.html”,但从您的问题中并不清楚。
| 归档时间: |
|
| 查看次数: |
8255 次 |
| 最近记录: |