Ueditor HTML༭ǰٶȿԴHTML༭
ģDjangoӦмɰٶUeditor HTML༭
װѾUeditor v1.2.2
ʹDjango-Ueditordz£
1װ
**һذװУ
python setup.py install
**ʹpip(Ƽ)
pip install DjangoUeditor
2INSTALL_APPSDjangoUeditor app£
INSTALLED_APPS = (
#........
'DjangoUeditor',
)
3urls.pyӣ
url(r'^ueditor/',include('DjangoUeditor.urls' ),name='ueditor'),
4models壺
from DjangoUeditor.models import UEditorField
class Blog(models.Model):
Name=models.CharField(,max_length=100,blank=True)
Content=UEditorField(' ',height=100,width=500,default='test',imagePath="uploadimg/",imageManagerPath="imglib",toolbars='mini',options={"elementPathEnabled":True},filePath='upload',blank=True)
˵
UEditorField̳models.TextField,ֱӽmodel涨models.TextFieldֱӸijUEditorFieldɡ
UEditorFieldṩ˶IJ
toolbars:ʾĹȡֵΪmini,normal,fullСһ㣬ȫĬϵĹҪsettingsԼʾťμܡ
imagePath:ͼƬϴ·,"images/",ʵϴ"{{MEDIA_ROOT}}/images"ļ
filePath:ϴ·,"files/",ʵϴ"{{MEDIA_ROOT}}/files"ļ
imageManagerPath:ͼƬʾ·"imglib/",ʵϴ"{{MEDIA_ROOT}}/imglib",ָĬ=imagepath
optionsUEditorֵ͡μUeditorĵueditor_config.js˵
css:༭textareaCSSʽ
widthheight:༭ĿȺ߶ȣΪλ
5ڱʹ÷dz볣formֶûʲô£
class TestUeditorModelForm(forms.ModelForm):
class Meta:
model=Blog
***********************************
ModelFormַʹã
1: ʹforms.UEditorField
from DjangoUeditor.forms import UEditorField
class TestUEditorForm(forms.Form):
Description=UEditorField("",initial="abc",width=600,height=800)
2: widgets.UEditorWidget
from DjangoUeditor.widgets import UEditorWidget
class TestUEditorForm(forms.Form):
Content=forms.CharField(label="",widget=UEditorWidget(width=800,height=500, imagePath='aa', filePath='bb',toolbars={}))
widgets.UEditorWidgetforms.UEditorFieldmodels.UEditorFieldһ
6
**ڰٶueditor 1.2.2װѾˣҪٶⰲװ
**Ŀǰʱ֧ueditorIJ
**DjangoĬϿCSRFмıûм{% csrf_token %}ôϴļͼƬʱʧ
**֧Djangoadmin棬ǹʾĿǰ֪ôdjangoCSSгͻ