django ace提供了ajax.org ace与django的集成
django-ace的Python项目详细描述
用法
from django import forms from django_ace import AceWidget class EditorForm(forms.Form): text = forms.CharField(widget=AceWidget)
通过指定 语言:
class EditorForm(forms.Form): text = forms.CharField(widget=AceWidget(mode='css'))
还支持主题:
class EditorForm(forms.Form): text = forms.CharField(widget=AceWidget(mode='css', theme='twilight'))
其他选项包括:
class EditorForm(forms.Form): text = forms.CharField(widget=AceWidget(wordwrap=False, width="500px", height="300px", showprintmargin=True))
安装
使用pip安装:
pip install django_ace
更新INSTALLED_APPS:
INSTALLED_APPS = ( # ... 'django_ace', )
示例项目
源代码中包含一个示例项目,请尝试:
cd example/ virtualenv .env . .env/bin/activate pip install -e .. ./manage.py makemigrations app ./manage.py migrate ./manage.py runserver
然后浏览到http://localhost:8000。
更改日志
v1.0.5
- 新窗口小部件选项tabsize。
- 将ace editor升级至v1.4.2版本。
v1.0.4
- 将django兼容性更新为>1.11,<=2.1
- 新窗口小部件选项minLines,maxLines,showinvisibles,usesofttabs。
- 将ace editor升级至v1.4.0版本。
- django 1.11的更新示例
- PEP8改进
v1.0.2
- 将ace editor升级至1.1.8版本
- 添加对ShowPrintMargin的支持
v1.0.1
- 通过删除不推荐的导入添加对django 1.7的支持。
v1.0.0
- 初次发布。