Integrating text editor with Django forms
hariselva | Feb. 11, 2020, 2:56 a.m.

django-tinymce4-lite is a reworked fork of django-tinymce4. It provides a fully functional TinyMCE 4 editor widget that can be used in Django forms and models.

pip install django-tinymce4-lite

TINYMCE

Add tinymce to INSTALLED_APPS in settings.py for your Django project:

INSTALLED_APPS = (
    ...
    'tinymce',
)
from tinymce import HTMLField
class MyModel(models.Model):
    ...
    content = HTMLField('Content')

Below config has to set in settings.py to override the configuration

TINYMCE_DEFAULT_CONFIG = {
    'selector': 'textarea',
    'theme': 'modern',
    'plugins': 'link image preview codesample contextmenu table code',
    'toolbar1': 'fontselect | fontsizeselect | formatselect | bold italic underline | alignleft aligncenter alignright alignjustify '
               '| bullist numlist | outdent indent | table | link image | codesample | preview code',
    'font_formats': 'Arial=arial,helvetica,sans-serif; Verdana=verdana;Courier New=courier new,courier,monospace; AkrutiKndPadmini=Akpdmi-n',
    'fontsize_formats': '8px 9px 10px 11px 12px 14px 16px 18px 24px 36px 48px',
    'block_formats': 'Paragraph=p; Heading 1=h1; Heading 2=h2; Heading 3=h3; Heading 4=h4; Heading 5=h5; Heading 6=h6; Preformatted=pre',
    'contextmenu': 'formats | link image',
    'menubar': False,
    'inline': False,
    'statusbar': True,
    'height': 360,
}