我正在尝试将django CMS从3.3.0升级到版本3.4.1。我正在按照升级说明here。
运行后
python manage.py migrate
python manage.py cms fix-tree
我启动了我的开发服务器并导航到我的一个页面,但没有一个配置的占位符呈现。
我已经验证了该页面中有占位符,以及数据库中这些占位符的插件。此外,通过简单地降级回版本3.3.0,占位符和插件都可以再次正确呈现。
我不是手动渲染占位符,正如可能的问题here in the upgrade notes所提到的那样。我只是使用文档here中提到的cms_tags
中的占位符标记。
有谁知道问题可能是什么?如果我能提供任何进一步的信息或澄清,请告诉我。提前谢谢!
修改:
有人问我是否提供了占位符未呈现的示例模板。我在下面提供了这个:
CMS / home.html的
{% extends 'cms/base.html' %}
{% load cms_tags sekizai_tags %}
{% load humanize %}
{% load staticfiles %}
{%block content %}
<div class=" o-page-content o-page-content--home">
<div class="o-hero o-hero--home">
<div class="o-hero__content">
<h1 class="o-hero__heading">
<span class="o-hero__heading--topline">Your guide to</span>
financial <span class="o-hero__heading--emphasized">health.</span>
</h1>
</div>
</div>
<div class="l-container">
{{ block.super }}
<div class="l-row">
<div class="l-whole--xs c-under-hero">
<h1 class="c-under-hero__text">Some content</h1>
</div>
</div>
<div class="l-row">
<div class="l-whole--xs">
<div class="o-service-block">
{% placeholder 'body' %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
CMS / base.html文件
{% load cms_tags staticfiles sekizai_tags django_seo_js %}
{% load static from staticfiles %}
{% load imagekit %}
{% load pipeline %}
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8" {% if post.vertical %}ng-app="app" ng-controller="{{ post.vertical }}Controller"{% endif %}> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9" {% if post.vertical %}ng-app="app" ng-controller="{{ post.vertical }}Controller"{% endif %}>
<![endif]-->
<!--[if !IE]><!-->
<html lang="en" ng-app="app"
{% if request.current_page.verticalextension %}
ng-controller="{{ request.current_page.verticalextension.vertical }}Controller as vm"
{% endif %}><!--<![endif]-->
<head>
{% block appletitle %}
{% endblock %}
<!-- For the bots -->
{% block metadata %}
<!-- Meta -->
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="en-US" property="og:locale" itemprop="inLanguage"/>
{% endblock %}
{% block header_scripts %}
{% seo_js_head %}
{% endblock %}
{% addtoblock "css" %}
<!-- CSS Support -->
{% stylesheet 'base' %}
{% if request.toolbar.edit_mode %}
{% stylesheet 'edit' %}
{% endif %}
{% endaddtoblock %}
{% render_block "css" %}
<!-- Style Sheet Files -->
{% block css_files %}
{% stylesheet request.onsite_stylesheet %}
{% endblock %}
<!-- Adding a favicon -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{% static "img/apple-touch-icon-144x144.png" %}" />
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{% static "img/apple-touch-icon-152x152.png" %}" />
<link rel="icon" type="image/png" href="{% static "img/favicon-32x32.png" %}" sizes="32x32" />
<link rel="icon" type="image/png" href="{% static "img/favicon-16x16.png" %}" sizes="16x16" />
<meta name="msapplication-TileColor" content="#FFFFFF"/>
<meta name="msapplication-TileImage" content="{% static "img/mstile-144x144.png" %}" />
<!-- Include the dataLayer, Google Tag Manager, and the MF variable -->
{% include 'cms/partials/data_layer.html' %}
<!-- Analytics Tracking Codes -->
{% include 'cms/partials/segment.html' %}
<!-- Import jQuery before all other JS -->
<script src='{% static "bower_components/jquery/dist/jquery.min.js" %}'></script>
<!-- Taboola Script -->
{% include 'cms/partials/taboola.html' %}
</head>
<body>
{% cms_toolbar %}
<!--=== Header ===-->
{% block header_content %}
{% include 'cms/partials/header.html' %}
{% endblock %}
{% block breadcrumbs%}
{% endblock %}
{% block content %}
{% endblock %}
{% block input_block %}
{% endblock %}
{% block footer_content %}
{% include 'cms/partials/footer.html' %}
{% endblock %}
{% block optin %}
{% include 'cms/partials/optin.html' %}
{% endblock optin %}
<script>
$(document).ready(function() {
App.init();
});
</script>
{% addtoblock "js" %}
<!-- Mixpanel -->
<script src='{% static "js/vendor/mixpanel.js" %}'></script>
{% javascript 'base' %}
<!-- Djangular Javascript -->
<script src="{% static 'djangular/js/django-angular.min.js' %}" type="text/javascript"></script>
<!-- custom angular code -->
{% javascript 'ng' %}
{% javascript 'jq' %}
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&extension=.js"></script>
{% if request.toolbar.edit_mode %}
{% javascript 'edit' %}
{% endif %}
{% endaddtoblock %}
{% block page_scripts %}
{% endblock %}
{% render_block "js" %}
</body>
</html>
您可以看到cms / home.html中包含的{% placeholder 'body' %}
标记,并且我已经包含了cms / base.html,因为主页模板继承了它。