占位符不在django-cms中工作

时间:2013-01-22 13:35:14

标签: python django content-management-system django-cms

我正在使用django cms来开发一个网站,配置一切并正常工作,以下是我的代码文件

settings.py

   ........
   ........

TEMPLATE_CONTEXT_PROCESSORS = (
       'django.contrib.auth.context_processors.auth',
       'django.core.context_processors.i18n',
       'django.core.context_processors.request',
       'django.core.context_processors.media',
       'django.core.context_processors.static',
       'cms.context_processors.media',
       'sekizai.context_processors.sekizai',
)

CMS_PLACEHOLDER_CONF = {
    'terms_and_conditions': {
        'name': gettext('Terms & Conditions'),
        'plugins': ['TextPlugin'],
    },
}

CMS_TEMPLATES = (
       ('home.html', 'Home Page'),
)

........
.......

urls.py

from django.conf.urls import patterns, include, url
from django.conf.urls.defaults import *
from django.conf.urls.i18n import i18n_patterns
from django.conf import settings
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls)),
     url(r'^', include('cms.urls')),
)

base.html文件

{% load cms_tags sekizai_tags menu_tags %}
<html>
<head> 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to Services</title>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
    <div class="promoinner">
       {% block base_content %}{% endblock %} 
    </div>
  {% render_block "js" %}
</body>
</html>

home.html的

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

{% block base_content %}
   {% placeholder "terms_and_conditions" or  %}
       <p>This data should be present in the editor in editing mode before entering anything in to plugins, because this data is giving through html</p>
       <p>But when i tried to edit the placeholder i cant see the data(that we mentioned in tags of html file), i can able to see the placeholder and i can able to add some data in to text plugin </p>
   {% endplaceholder %}
{% endblock %}

这里的问题是,我们通过html文件中的p标记提供了一些数据,所以当我打开网址http://localhost:8000/?edit时,我可以看到名为的占位符 正如我们在settings.py文件中提到的Terms & Conditions,但我们通过标签在html文件中提供的数据不可编辑且无法看到,同时我可以使用{{{{{{ 1}}插件。

任何人都可以让我知道为什么通过text中的html标签提到的数据不可编辑甚至无法看到?

1 个答案:

答案 0 :(得分:1)

尝试在“base.html”或“home.html”中加载占位符标签(看起来像您缺少的“placeholder_tags”)...

{%load cms_tags sekizai_tags menu_tags placeholder_tags%}