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

Install:

  1. pip install django-suit-redactor
  2. Add suit_redactor to INSTALLED_APPS
  3. 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:

_images/full-width.png

CKEditor 4.x

Install:

  1. pip install django-suit-ckeditor
  2. Add suit_ckeditor to INSTALLED_APPS
  3. 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:

_images/ckeditor.png

Other wysiwyg apps

Also you can integrate WYSIWYG editor using any other third party apps.

Few third party apps we tested for Django Suit: