{ "info": { "author": "Jaap Roes", "author_email": "jaap.roes@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "======================\nDjango Rich Text Field\n======================\n\n.. image:: https://badge.fury.io/py/django-richtextfield.svg\n :target: https://pypi.python.org/pypi/django-richtextfield/\n :alt: Latest Version\n\n.. image:: https://travis-ci.org/jaap3/django-richtextfield.svg?branch=master\n :target: https://travis-ci.org/jaap3/django-richtextfield\n\n.. image:: https://coveralls.io/repos/jaap3/django-richtextfield/badge.svg?branch=master\n :target: https://coveralls.io/r/jaap3/django-richtextfield?branch=master\n\nA Django model field and widget that renders a customizable rich\ntext/WYSIWYG widget.\n\nSupports global `editor settings`_, reusable `editor profiles`_\nand per `field & widget settings`_. There's built-in support for\npluggable server side `content sanitizers`_.\n\nTested with TinyMCE_ and CKEditor_. Designed to be easily extended to\nuse other editors.\n\n\nQuickstart\n----------\n\nInstall ``django-richtextfield`` and add it to your Django\nproject's ``INSTALLED_APPS``, ``django.contrib.admin`` must also be in ``INSTALLED_APPS``::\n\n INSTALLED_APPS = [\n 'django.contrib.admin',\n ...\n 'djrichtextfield'\n ]\n\nAdd the urls to the project's urlpatterns::\n\n path('djrichtextfield/', include('djrichtextfield.urls'))\n\nConfigure ``django-richtextfield`` in ``settings.py``::\n\n DJRICHTEXTFIELD_CONFIG = {\n 'js': ['//tinymce.cachefly.net/4.1/tinymce.min.js'],\n 'init_template': 'djrichtextfield/init/tinymce.js',\n 'settings': {\n 'menubar': False,\n 'plugins': 'link image',\n 'toolbar': 'bold italic | link image | removeformat',\n 'width': 700\n }\n }\n\nNow you're ready to use the field in your models::\n\n from djrichtextfield.models import RichTextField\n\n class Post(models.Model):\n content = RichTextField()\n\nor forms::\n\n from djrichtextfield.widgets import RichTextWidget\n\n class CommentForm(forms.ModelForm):\n content = forms.CharField(widget=RichTextWidget())\n\n\nConfiguration\n-------------\n\nDefine the ``DJRICHTEXTFIELD_CONFIG`` dictionary in your project settings.\nThis dictionary can have the following keys:\n\n.. _conf_js:\n\nJavascript souce(s)\n^^^^^^^^^^^^^^^^^^^\n\n``'js'``\n A list of required javascript files. These can be URLs to a CDN or paths\n relative to your ``STATIC_URL`` e.g.::\n\n 'js': ['//cdn.ckeditor.com/4.4.4/standard/ckeditor.js']\n\n or::\n\n 'js': ['path/to/editor.js', 'path/to/plugin.js']\n\n.. _conf_css:\n\nCSS souce(s)\n^^^^^^^^^^^^\n\n``'css'``\n A dictionary of CSS files required for various forms of output media.\n These can be URLs to a CDN or paths relative to your ``STATIC_URL`` e.g.::\n\n 'css': {\n 'all': [\n 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css'\n ]\n }\n\n or::\n\n 'css': {'all': ['path/to/editor.css', 'path/to/plugin.css']}\n\n\n.. _conf_init_template:\n\nEditor init template\n^^^^^^^^^^^^^^^^^^^^\n\n``'init_template'``\n Path to the `init template`_ for your editor. Currently\n ``django-richtextfield`` ships with two templates, either::\n\n 'init_template': 'djrichtextfield/init/tinymce.js'\n\n or::\n\n 'init_template': 'djrichtextfield/init/ckeditor.js'\n\n.. _conf_settings:\n\nEditor settings\n^^^^^^^^^^^^^^^\n\n``'settings'``\n A Python dictionary with the **default** configuration data for your\n editor e.g.::\n\n 'settings': { # TinyMCE\n 'menubar': False,\n 'plugins': 'link image',\n 'toolbar': 'bold italic | link image | removeformat',\n 'width': 700\n }\n\n or::\n\n 'settings': { # CKEditor\n 'toolbar': [\n {'items': ['Format', '-', 'Bold', 'Italic', '-',\n 'RemoveFormat']},\n {'items': ['Link', 'Unlink', 'Image', 'Table']},\n {'items': ['Source']}\n ],\n 'format_tags': 'p;h1;h2;h3',\n 'width': 700\n }\n\n.. _conf_profiles:\n\nEditor profiles\n^^^^^^^^^^^^^^^\n\n``'profiles'``\n This is an **optional** configuration key. Profiles are \"named\" custom\n settings used to configure specific type of fields. You can configure\n profiles like this::\n\n 'profiles': {\n 'basic': {\n 'toolbar': 'bold italic | removeformat'\n },\n 'advanced': {\n 'plugins': 'link image table code',\n 'toolbar': 'formatselect | bold italic | removeformat |'\n ' link unlink image table | code'\n }\n }\n\n .. note:: A profile is treated the same way as directly defined\n `field & widget settings`_. This means that\n profile settings are merged with the defaults!\n\n.. _conf_sanitizer:\n\nContent sanitizers\n^^^^^^^^^^^^^^^^^^\n\n``'sanitizer'``\n This is an **optional** configuration key. A sanitizer can be used to\n process submitted values before it is returned by the widget. By default no\n processing is performed on submitted values. You can configure a sanitizer\n either by providing a function or an importable path to a function, like\n so::\n\n 'sanitizer': lambda value: '