Django 配置 Ueditor
来源:互联网 发布:监管网络的部门 编辑:程序博客网 时间:2024/05/19 16:06
Ueditor下载
下载Ueditor的包,拷贝到和其他App同级的目录下
Ueditor安装
和普通App的安装一样,将Ueditor安装到install_app
配置Django的media路径
MEDIA_URL = '/media/'MEDIA_ROOT = './media/'
编写Ueditor的模型form
# coding:utf-8from django import formsfrom DjangoUeditor.widgets import UEditorWidgetfrom DjangoUeditor.forms import UEditorField, UEditorModelFormfrom models import Informationclass InformationUEditorForm(forms.Form): description = UEditorField("内容", initial="请再次填写内容", width=500, height=100, filePath="img/")class InformationUEditorModelForm(UEditorModelForm): class Meta: model = Information fields = '__all__'
filepath为编辑器上传文件的路径
生成页面参数
form = InformationUEditorForm(initial={'description': '请在此输入文字'})
在模版页面引入Ueditor
{{ form.media }}
配置编辑器
<div id="description" style="width:100%; height: 400px;"></div><script type="text/javascript"> var w = 1000; var id_content = UE.getEditor('description',{'initialFrameWidth': w, 'initialFrameHeight': 300, 'serverUrl': '/ueditor/controller/?imagePathFormat=img/&filePathFormat=img/'}); id_content.ready(function(){ id_content.setContent(""); });</script>
其中/ueditor/controller/?imagePathFormat=img/&filePathFormat=img/配置的是图片和文件上传的位置,是相对于media路径的,假如上传一张图片后,可以看到图片的URL的路径部分为”/media/img/下载_20170604065421_194.png”
阅读全文
0 0
- Django 配置 Ueditor
- Django 使用UEditor
- Django使用Ueditor
- ueditor配置
- ueditor配置
- ueditor 详细配置
- ueditor使用配置总结
- ueditor使用配置总结
- Ueditor上传配置
- ueditor图片上传配置
- ThinkPHP3.2.3配置UEditor。
- ueditor 配置无效?
- ueditor配置方法
- Ueditor上传文件配置
- UEditor上传配置
- Ueditor 图片上传配置
- ueditor抓取文件配置
- UEditor完整配置项
- disable hwui---hardware render
- 计算机编码详解
- 自定义控件之柱状图
- 51nod-1119 机器人走方格(组合数学,离散数学)
- Combination Sum (without Duplication)
- Django 配置 Ueditor
- 设计模式-观察者模式 C++实现
- 实现queue和stack的拷贝构造函数的一个思路
- php代码注释
- 为什么推荐Zookeeper作注册中心
- HashMap
- MySQL 学习<十一> 触发器
- MFC的RTTI机制的宏实现示例解析
- sql with as 用法