Ckeditor "Convert the HTMLField to a Placeholderfield and configure the placeholder to only accept TextPlugin"
Ckeditor "Convert the HTMLField to a Placeholderfield and configure the placeholder to only accept TextPlugin"
也许我不明白一些简单的事情。第二天在看文档,不懂怎么在django-cms中使用ckeditor,在第三方插件中。
Here写成:
Usage as a model field If you want to use the widget on your own model
fields, you can! Just import the provided HTMLField like so:
from djangocms_text_ckeditor.fields import HTMLField
And use it in
your models, just like a TextField:
class MyModel(models.Model):
myfield = HTMLField(blank=True)
This field does not allow you to embed any other CMS plugins within the text editor. Plugins can only
be embedded within Placeholder fields.
If you need to allow additional plugins to be embedded in a HTML
field, convert the HTMLField to a Placeholderfield and configure the
placeholder to only accept TextPlugin. For more information on using
placeholders outside of the CMS see:
http://docs.django-cms.org/en/latest/how_to/placeholders.html
目前 HTMLField 正在运行,在阅读说明后我不明白如何在完全集成到 django-cms 中的第三方插件中 "convert the HTMLfield to a Placeholder and configure the placeholder to only accept TextPlugin"。我从未在第三方插件中创建占位符。
我的目标是在第三方插件中设置一个文本框,我可以在其中使用格式化功能编辑文本。我正在使用最新的 Django-CMS。默认情况下,它有 djangocms_text_ckeditor.
谢谢!
models.py:
[..]
from djangocms_text_ckeditor.fields import HTMLField
class Question(models.Model):
content = HTMLField(blank=True)
[..]
模板
[..]
{% load cms_tags %}
[..]
{% for field in form %}
{{ field }}
{% endfor %}
[..]
我的文本区域如下所示:
<textarea name="content" cols="40" rows="10" class="CMS_CKEditor" data-ckeditor-basepath="/static/djangocms_text_ckeditor/ckeditor/" id="id_content"></textarea>
我注意到可以通过管理面板使用这个新文本区域的编辑器,但站点上的用户没有任何变化。视觉上是一个普通的textarea
我找到了解决方案。我必须在模板中包含“{{ form.media }}”标签
<form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}
{{ form.media }}
[..]
也许我不明白一些简单的事情。第二天在看文档,不懂怎么在django-cms中使用ckeditor,在第三方插件中。
Here写成:
Usage as a model field If you want to use the widget on your own model fields, you can! Just import the provided HTMLField like so:
from djangocms_text_ckeditor.fields import HTMLField
And use it in your models, just like a TextField:
class MyModel(models.Model):
myfield = HTMLField(blank=True)
This field does not allow you to embed any other CMS plugins within the text editor. Plugins can only be embedded within Placeholder fields.If you need to allow additional plugins to be embedded in a HTML field, convert the HTMLField to a Placeholderfield and configure the placeholder to only accept TextPlugin. For more information on using placeholders outside of the CMS see:
http://docs.django-cms.org/en/latest/how_to/placeholders.html
目前 HTMLField 正在运行,在阅读说明后我不明白如何在完全集成到 django-cms 中的第三方插件中 "convert the HTMLfield to a Placeholder and configure the placeholder to only accept TextPlugin"。我从未在第三方插件中创建占位符。
我的目标是在第三方插件中设置一个文本框,我可以在其中使用格式化功能编辑文本。我正在使用最新的 Django-CMS。默认情况下,它有 djangocms_text_ckeditor.
谢谢!
models.py:
[..]
from djangocms_text_ckeditor.fields import HTMLField
class Question(models.Model):
content = HTMLField(blank=True)
[..]
模板
[..]
{% load cms_tags %}
[..]
{% for field in form %}
{{ field }}
{% endfor %}
[..]
我的文本区域如下所示:
<textarea name="content" cols="40" rows="10" class="CMS_CKEditor" data-ckeditor-basepath="/static/djangocms_text_ckeditor/ckeditor/" id="id_content"></textarea>
我注意到可以通过管理面板使用这个新文本区域的编辑器,但站点上的用户没有任何变化。视觉上是一个普通的textarea
我找到了解决方案。我必须在模板中包含“{{ form.media }}”标签
<form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}
{{ form.media }}
[..]