我已经玩了几天的mezzanine,一直在关注这个博客,对我非常有帮助。
现在我需要创建一堆基于自定义模板的页面。我的自定义模板叫做content.html
。
我已经将它放在myProject > myApp/theme文件夹 > templates > pages > content.html
中,但是当我查看管理控制台时,下拉菜单中没有内容。
我该如何让mezzanine将我的content.html
页面识别为一个模板?
我已经玩了几天的mezzanine,一直在关注这个博客,对我非常有帮助。
现在我需要创建一堆基于自定义模板的页面。我的自定义模板叫做content.html
。
我已经将它放在myProject > myApp/theme文件夹 > templates > pages > content.html
中,但是当我查看管理控制台时,下拉菜单中没有内容。
我该如何让mezzanine将我的content.html
页面识别为一个模板?
content.html
不会自动显示在您网站的下拉菜单中。
您需要进入管理站点,并明确声明一个页面我的内容
,在那里您希望content.html
出现在您的页面层次结构中。
为了让 Mezzanine 匹配这两个(即模板content.html
和管理页面我的内容
):
my content
's Title field (in admin site) should be content
, my content
) should be content
(if you decide the title will not be content
),Or, if you want content.html
to have a custom slug, say nicecontent
, then fill URL field with nicecontent
and add to url.py
a pattern for content.html
with a matching slug, so:
url("^nicecontent/$", direct_to_template, {"template": "path/to/content.html"}, name="name_for_content").
Mezzanine使用一种查找模板名称的方法,从最广泛的("page.html",所有其他模板也都扩展了它),到根据其内容类型命名的模板(richtextpage.html、gallery.html等),再到最细粒度的级别,即与单个页面的url/slug匹配的模板。
这些都在文档中有详细说明:
http://mezzanine.jupo.org/docs/content-architecture.html#page-templates
听起来你可能在寻找“page.html”,但从你的问题中并不清楚。