
富文本编辑器:ueditor、ckeditor、kindeditor
在INSTALLED_APPS中添加
在settings/dev.py中添加
在总路由中添加
ckeditor提供了两种类型的Django模型类字段
修改应用/models.py里面的字段信息,记得要重新数据迁移
效果图
一、下载安装python setup.py install
二、
1.将tinymce/static/tiny_mce文件夹放到your_project/static目录下;
2.将tinymce文件夹放到your_project目录下
三、在urls.py文件中加入:
url(r'^tinymce/',include('tinymce.urls')),
四、在settings.py文件中加入:
INSTALLED_APPS = (
'tinymce',
)
五、在settings.py文件中加入:
TINYMCE_JS_URL=MEDIA_URL+'/static/tiny_mce/tiny_mce_src.js'
TINYMCE_JS_ROOT=MEDIA_ROOT+'/static/tiny_mce/'
六、在settings.py文件中加入:
TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'theme_advanced_toolbar_location' : "top",
'theme_advanced_toolbar_align' : "left",
‘width’: 600,
‘height’: 400,
}
七、修改models.py文件
from your_project.tinymce import models as tinymce_models
class Post(models.Model):
body=tinymce_models.HTMLField()
这个几乎不需要配置啊。 你先把tineymce安装好。这个看它的教程中的installation就可以搞定。
<!-- Place inside the <head> of your HTML --><script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea"
})
</script>
<!-- Place this in the body of the page content -->
<form method="post">
<textarea></textarea>
</form>
你只需要将form中的action写成你的django对应的处理的path就可以了。
内容加载,可能就需要用template了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)