DjangoCMS - 模板中的占位符不会显示在django cms结构视图

时间:2018-02-28 20:58:17

标签: python django django-cms

我正在使用djangoCMS在我的网站模板中添加CMS功能,但我放置在放置位置的占位符没有显示,我已将CMS_TEMPLATES定义为MY settings.py并放置{我在{% load cms_tags sekizai_tags sorl_thumbnail %}上{1}}并在我的其他扩展base.html的模板上添加了{% load cms_tags sekizai_tags %},但当我登录djangoCMS管理员并访问我的网页时,我发现我的{中没有占位符{1}}。这可能是什么问题?

settings.py

base.html

base.html文件

structure view

solutions.html

CMS_TEMPLATES = [
      ('index.html','Home'),
      ('solutions.html','solutions'),
      ('commercial.html','Commercial Solar Solution'),
      ('residential.html','Residential Solar Solution'),
      ('on-grid.html','On grid solutions'),
      ('off-grid.html','Off Grid solutions'),
      ('water-heating.html','Solar Water Heating'),
      ('solar-water-pumping.html','Solar water pumping'),
      ('hybrid-grid.html','Hybrid Solutions'),
      ('outdoor-lighting.html','Outdoor Lighting'),
      ('contacts.html','Contacts'),
      ('terms-of-use.html','Terms of use'),

1 个答案:

答案 0 :(得分:0)

在您的子模板(扩展基本模板)中,应该是这样的:

{% extends "base.html" %}
{% load cms_tags %}

{% block title %}{% page_attribute "page_title" %}{% endblock title %}

{% block content %}
    <div>
        {% placeholder "feature" %}
    </div>
    <div>
        {% placeholder "content" %}
    </div>
    <div>
        {% placeholder "splashbox" %}
    </div>
{% endblock content %}

基本模板应如下所示:

{% load cms_tags menu_tags sekizai_tags %}
<!doctype html>
<html>
    <head>
        <title>{% block title %}This is my new project home page{% endblock title %}</title>
    </head>
    <body>
        {% cms_toolbar %}
        <div class="container">
            <ul class="nav">
                {% show_menu 0 100 100 100 %}
            </ul>
            {% block content %}{% endblock content %}
        </div>
    </body>
</html>