Django使用富文本編輯器
阿新 • • 發佈:2017-05-14
media django textarea class 編輯 reat 字段名 ext 富文本
1.下載kindeditor
網址:http://kindeditor.net/demo.php
2.解壓到項目中
地址:\static\js\kindeditor-4.1.10
3.刪除沒用的文件
例如:example,php,asp等
4.在需要使用富文本編輯器的model中定義meta類:
class Media: js = ( ‘/static/js/kindeditor-4.1.10/kindeditor-min.js‘, ‘/static/js/kindeditor-4.1.10/lang/zh_CN.js‘, ‘/static/js/kindeditor-4.1.10/config.js‘, )
5.在kindeditor-4.1.10目錄中定義config.js文件:
KindEditor.ready(function(K) { K.create(‘textarea[name=需要使用富文本的字段名]‘,{ width:‘800px‘, height:‘200px‘, }); });
Django使用富文本編輯器