简体   繁体   English

占位符在django-cms中不起作用

[英]placeholder not working in django-cms

I am using django cms to develop a site, configured everything and working fine,and below are my code files 我正在使用django cms开发一个网站,配置了所有内容,并且工作正常,以下是我的代码文件

settings.py 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 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 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 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 %}

Here all the problem is, we are giving some data through p tags in html file, so when i opened the url http://localhost:8000/?edit , i can able to see the placeholder named as Terms & Conditions as we mentioned in the settings.py file, but the data we given in html file through tags is not editable and cant be seen, at the same time i can able to add some text in to placeholder using text plugin. 这里所有的问题是,我们通过html文件中的p标签提供了一些数据,因此当我打开url http://localhost:8000/?edit ,我能够看到名为“ Terms & Conditions的占位符,正如我们提到的那样在settings.py文件中,但是通过标记在html文件中提供的数据不可编辑且无法看到,同时我可以使用text插件在占位符中添加一些文本。

Can anyone please let me know why the data that mentioned through html tags in home.html is not editable and even cant be seen ? 任何人都可以让我知道为什么通过home.html html标记提及的数据不可编辑甚至看不到吗?

try to load the placeholder tags in "base.html" or "home.html" like(looks like your missing "placeholder_tags")... 尝试以“ base.html”或“ home.html”之类的方式加载占位符标签(看起来像您缺少的“ placeholder_tags”)...

{% load cms_tags sekizai_tags menu_tags placeholder_tags %} {%load cms_tags sekizai_tags menu_tags placeholder_tags%}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM