CKEditor 5 for django.
Project description
CKEditor 5 for Django >= 2.0
Quick start
pip install django-ckeditor-5
Add “django_ckeditor_5” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'django_ckeditor_5', ]
Include the app URLconf in your project urls.py like this:
urlpatterns += [ path("ckeditor5/", include('django_ckeditor_5.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Add to your settings.py:
STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') customColorPalette = [ { 'color': 'hsl(4, 90%, 58%)', 'label': 'Red' }, { 'color': 'hsl(340, 82%, 52%)', 'label': 'Pink' }, { 'color': 'hsl(291, 64%, 42%)', 'label': 'Purple' }, { 'color': 'hsl(262, 52%, 47%)', 'label': 'Deep Purple' }, { 'color': 'hsl(231, 48%, 48%)', 'label': 'Indigo' }, { 'color': 'hsl(207, 90%, 54%)', 'label': 'Blue' }, ] CKEDITOR_5_CUSTOM_CSS = 'path_to.css' # optional CKEDITOR_5_CONFIGS = { 'default': { 'toolbar': ['heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'imageUpload', ], }, 'extends': { 'blockToolbar': [ 'paragraph', 'heading1', 'heading2', 'heading3', '|', 'bulletedList', 'numberedList', '|', 'blockQuote', 'imageUpload' ], 'toolbar': ['heading', '|', 'outdent', 'indent', '|', 'bold', 'italic', 'link', 'underline', 'strikethrough', 'code','subscript', 'superscript', 'highlight', '|', 'bulletedList', 'numberedList', 'todoList', '|', 'blockQuote', 'imageUpload', '|', 'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'mediaEmbed', 'removeFormat', 'insertTable',], 'image': { 'toolbar': ['imageTextAlternative', 'imageTitle', '|', 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight', 'imageStyle:alignCenter', 'imageStyle:side', '|'], 'styles': [ 'full', 'side', 'alignLeft', 'alignRight', 'alignCenter', ] }, 'table': { 'contentToolbar': [ 'tableColumn', 'tableRow', 'mergeTableCells' ], 'tableProperties': { 'borderColors': customColorPalette, 'backgroundColors': customColorPalette }, 'tableCellProperties': { 'borderColors': customColorPalette, 'backgroundColors': customColorPalette } }, 'heading' : { 'options': [ { 'model': 'paragraph', 'title': 'Paragraph', 'class': 'ck-heading_paragraph' }, { 'model': 'heading1', 'view': 'h1', 'title': 'Heading 1', 'class': 'ck-heading_heading1' }, { 'model': 'heading2', 'view': 'h2', 'title': 'Heading 2', 'class': 'ck-heading_heading2' }, { 'model': 'heading3', 'view': 'h3', 'title': 'Heading 3', 'class': 'ck-heading_heading3' } ] } } }
Add to your models.py:
from django.db import models from django_ckeditor_5.fields import CKEditor5Field class Article(models.Model): title=models.CharField('Title', max_length=200) text=CKEditor5Field('Text', config_name='extends')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-ckeditor-5-0.0.6.tar.gz.
File metadata
- Download URL: django-ckeditor-5-0.0.6.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dba88dc8763e6e9449f174f417c119b1dd9e6912e30c2c03d8191e7820ee567
|
|
| MD5 |
a5f990f16d5bac3868428d759bb47ec5
|
|
| BLAKE2b-256 |
a9ffa7c693a1af49ed4196f4dc35c92b2a70621cf025cb6dde6d76f5e9036207
|
File details
Details for the file django_ckeditor_5-0.0.6-py3-none-any.whl.
File metadata
- Download URL: django_ckeditor_5-0.0.6-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fbe7736e74d0121e642150e979bccf4f6f1bd3c9d86c9ef6800f16396e69fc3
|
|
| MD5 |
58f399f3bb515b1affef044fa6428f58
|
|
| BLAKE2b-256 |
aa96889658ceaeedb561a1bed67fadc84350c3c305a5336746163b3b0d841038
|