WYSIWYG editors¶
If you use third party wysiwyg editor app, you should follow its manual.
If you would like to use save horizontal space, you should use full-width fieldset class with your wysiwyg editor.
We tested many existing wysiwyg apps, but many of them were missing tests, had implementation or other flaws, so we decided to create our own. We are maintaining two simple wysiwyg apps for Imperavi Redactor and CKEditor.
Right now they doesn’t support any uploads or anything with Django urls related, however it is planned to improve and update these packages in future.
These packages are independent and Django Suit isn’t requirement.
Imperavi Redactor¶
- Package on github: django-suit-redactor
- Editor homepage: http://imperavi.com/redactor/
- License: Creative Commons Attribution-NonCommercial 3.0 license. For commercial use please buy license here.
- Demo: http://djangosuit.com/admin/examples/wysiwygeditor/add/
Install:
pip install django-suit-redactor
- Add
suit_redactor
toINSTALLED_APPS
- Editor options for
editor_options
parameter can be found in Redactor Docs
Usage:
from django.forms import ModelForm
from django.contrib.admin import ModelAdmin
from suit_redactor.widgets import RedactorWidget
class PageForm(ModelForm):
class Meta:
widgets = {
'name': RedactorWidget(editor_options={'lang': 'en'})
}
class PageAdmin(ModelAdmin):
form = PageForm
fieldsets = [
('Body', {'classes': ('full-width',), 'fields': ('body',)})
]
...
admin.site.register(Page, PageAdmin)
Preview:
CKEditor 4.x¶
- Package on github: django-suit-ckeditor
- Editor homepage: http://ckeditor.com
- License: GPL, LGPL and MPL Open Source licenses
- Demo: http://djangosuit.com/admin/examples/wysiwygeditor/add/
Install:
pip install django-suit-ckeditor
- Add
suit_ckeditor
toINSTALLED_APPS
- Editor options for
editor_options
parameter can be found in CKEditor Docs
Usage for CKEditor is the same as for Imperavi Redactor, just change RedactorWidget
to CKEditorWidget
:
from django.forms import ModelForm
from django.contrib.admin import ModelAdmin
from suit_ckeditor.widgets import CKEditorWidget
class PageForm(ModelForm):
class Meta:
widgets = {
'name': CKEditorWidget(editor_options={'startupFocus': True})
}
class PageAdmin(ModelAdmin):
form = PageForm
fieldsets = [
('Body', {'classes': ('full-width',), 'fields': ('body',)})
]
...
admin.site.register(Page, PageAdmin)
Preview:
Other wysiwyg apps¶
Also you can integrate WYSIWYG editor using any other third party apps.
Few third party apps we tested for Django Suit:
- django-tinymce - TinyMCE editor. Tested and works great
- django-ckeditor - CK Editor. Works great, but no support for CK Editor 4.x yet
- django-cked - CK Editor. Quite new and unfortunately not so stable. Supports CK Editor 4.x
- django-redactorjs - Imperavi Redactor.
- django-redactor - Imperavi Redactor. No Pypi package yet
- See also WYSIWYG Editors grid on DjangoPackages.com