Keine Beschreibung

zhangfisher b2508dd211 1.1.2.2 vor 14 Jahren
.idea b2508dd211 1.1.2.2 vor 14 Jahren
DUSite a5c3286ffd 1.1.2.2 vor 14 Jahren
DjangoUeditor b2508dd211 1.1.2.2 vor 14 Jahren
TestApp a5c3286ffd 1.1.2.2 vor 14 Jahren
manage.py a5c3286ffd 1.1.2.2 vor 14 Jahren
readme.txt b2508dd211 1.1.2.2 vor 14 Jahren
setup.py a5c3286ffd 1.1.2.2 vor 14 Jahren

readme.txt

Ueditor HTML±à¼­Æ÷ÊǰٶȿªÔ´µÄHTML±à¼­Æ÷£¬

±¾Ä£¿é°ïÖúÔÚDjangoÓ¦ÓÃÖм¯³É°Ù¶ÈUeditor HTML±à¼­Æ÷¡£
°²×°°üÖÐÒѾ­¼¯³ÉUeditor v1.2.2

ʹÓÃDjango-Ueditor·Ç³£¼òµ¥£¬·½·¨ÈçÏ£º

1¡¢°²×°·½·¨

**·½·¨Ò»£ºÏÂÔØ°²×°°ü£¬ÔÚÃüÁîÐÐÔËÐУº
python setup.py install
**·½·¨¶þ£ºÊ¹ÓÃpip¹¤¾ßÔÚÃüÁîÐÐÔËÐÐ(ÍÆ¼ö)£º
pip install DjangoUeditor

2¡¢ÔÚINSTALL_APPSÀïÃæÔö¼ÓDjangoUeditor app£¬ÈçÏ£º

INSTALLED_APPS = (
#........
'DjangoUeditor',
)


3¡¢ÔÚurls.pyÖÐÔö¼Ó£º

url(r'^ueditor/',include('DjangoUeditor.urls' ),name='ueditor'),

4¡¢ÔÚmodelsÖÐÕâÑù¶¨Ò壺

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Ö±½Ó¸Ä³ÉUEditorField¼´¿É¡£
UEditorFieldÌṩÁ˶îÍâµÄ²ÎÊý£º
toolbars:ÅäÖÃÄãÏëÏÔʾµÄ¹¤¾ßÀ¸£¬È¡ÖµÎªmini,normal,full£¬´ú±íС£¬Ò»°ã£¬È«²¿¡£Èç¹ûĬÈϵŤ¾ßÀ¸²»·ûºÏÄúµÄÒªÇó£¬Äú¿ÉÒÔÔÚsettingsÀïÃæÅäÖÃ×Ô¼ºµÄÏÔʾ°´Å¥¡£²Î¼ûºóÃæ½éÉÜ¡£
imagePath:ͼƬÉÏ´«µÄ·¾¶,Èç"images/",ʵÏÖÉÏ´«µ½"{{MEDIA_ROOT}}/images"Îļþ¼Ð
filePath:¸½¼þÉÏ´«µÄ·¾¶,Èç"files/",ʵÏÖÉÏ´«µ½"{{MEDIA_ROOT}}/files"Îļþ¼Ð
imageManagerPath:ͼƬ¹ÜÀíÆ÷ÏÔʾµÄ·¾¶£¬Èç"imglib/",ʵÏÖÉÏ´«µ½"{{MEDIA_ROOT}}/imglib",Èç¹û²»Ö¸¶¨ÔòĬÈÏ=imagepath¡£
options£ºÆäËûUEditor²ÎÊý£¬×ÖµäÀàÐÍ¡£²Î¼ûUeditorµÄÎĵµueditor_config.jsÀïÃæµÄ˵Ã÷¡£
css:±à¼­Æ÷textareaµÄCSSÑùʽ
width£¬height:±à¼­Æ÷µÄ¿í¶ÈºÍ¸ß¶È£¬ÒÔÏñËØÎªµ¥Î»¡£

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.UEditorWidgetºÍforms.UEditorFieldµÄÊäÈë²ÎÊýÓëÉÏÊömodels.UEditorFieldÒ»Ñù¡£


6¡¢ÆäËûÊÂÏ

**±¾³ÌÐò»ùÓÚ°Ù¶Èueditor 1.2.2£¬°²×°°üÀïÃæÒѾ­°üÀ¨ÁË£¬²»ÐèÒªÔÙ¶îÍâ°²×°¡£
**ĿǰÔÝʱ²»Ö§³ÖueditorµÄ²å¼þ
**DjangoĬÈÏ¿ªÆôÁËCSRFÖмä¼þ£¬Òò´ËÈç¹ûÄãµÄ±íµ¥Ã»ÓмÓÈë{% csrf_token %}£¬ÄÇôµ±ÄúÉÏ´«ÎļþºÍͼƬʱ»áʧ°Ü
**Ö§³ÖDjangoµÄadmin½çÃæ£¬µ«Êǹ¤¾ßÀ¸ÏÔʾ»áÓÐËõ½ø£¬Ä¿Ç°»¹²»ÖªµÀÔõô½â¾ö£¬¿ÉÄÜÊÇdjangoµÄCSSÓгåÍ»¡£