万里长征第二步——django个人博客(第六步 ——添加富文本编辑器)

时间:2024-04-14 22:10:57
  1. 下载kindeditor
  2. 在admin.py文件中配置链接
    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', #引入配置文件
    )
  3. 在kindeditor根目录下创建配置文件config.js,,并配置
    KindEditor.ready(function(K) {
    K.create('#textarea[name=content]',{ <!--定义需要插入富文本编辑器的路径-->
    width:800, <!-- 定义富文本编辑器的长宽-->
    height:200,
    });
    });