django-tinymce is a Django application that provides a widget to easily integrate the TinyMCE rich text editor into Django forms and models. It allows for highly customizable WYSIWYG editing experiences within Django projects, including the admin interface. The library is actively maintained with regular updates to support newer TinyMCE and Django versions.
pip install django-tinymceVerified import paths — ran on the pinned version, not inferred.
To quickly set up django-tinymce, first install the package and add 'tinymce' to your `INSTALLED_APPS`. Include `tinymce.urls` in your project's `urls.py`. Then, configure TinyMCE settings in `settings.py`, paying attention to `TINYMCE_JS_URL` for the TinyMCE JavaScript source (either self-hosted or CDN) and `TINYMCE_DEFAULT_CONFIG` for editor options. You can use `tinymce.models.HTMLField` directly in your models or `tinymce.widgets.TinyMCE` in your Django forms or admin definitions to apply the rich text editor.
Remove `spellchecker` from TinyMCE plugins in `TINYMCE_DEFAULT_CONFIG`. Set `'browser_spellcheck': True` instead.
Review and update `toolbar` and `plugins` settings in `TINYMCE_DEFAULT_CONFIG` according to TinyMCE 6 documentation and `django-tinymce` release notes.
Remove `TINYMCE_INCLUDE_JQUERY` from your `settings.py`. Ensure your project handles jQuery dependencies separately if still needed for other parts of your application.
Ensure your project runs on Python >= 3.7 and Django >= 3.2 to use `django-tinymce` v3.5.0 and newer versions.
Verify that `TINYMCE_JS_URL` in `settings.py` points to the correct `tinymce.min.js` file (either self-hosted in your static files or a CDN). Ensure Django's static files configuration is correct and that `{{ form.media }}` is included in your template's `<head>` section.Before submitting the form, ensure that `tinyMCE.triggerSave()` is called. This forces TinyMCE instances to update their corresponding `<textarea>` elements, making their content available for Django to process.