This commit is contained in:
bkfox 2020-09-22 02:14:51 +02:00
parent ea17141321
commit 1cc44fe0c7
3 changed files with 35 additions and 12 deletions

View File

@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _
from django.utils.functional import cached_property
import bleach
from ckeditor.fields import RichTextField
from ckeditor_uploader.fields import RichTextUploadingField
from filer.fields.image import FilerImageField
from model_utils.managers import InheritanceQuerySet
@ -76,7 +76,7 @@ class BasePage(models.Model):
on_delete=models.SET_NULL,
verbose_name=_('cover'), null=True, blank=True,
)
content = RichTextField(
content = RichTextUploadingField(
_('content'), blank=True, null=True,
)

View File

@ -122,19 +122,40 @@ except:
#-- django-CKEditor
CKEDITOR_CONFIGS = {
"default": {
"toolbar": "Custom",
"format_tags": "h1;h2;h3;p;pre",
"toolbar_Custom": [[
"Format", "RemoveFormat", "-",
"Bold", "Italic", "Subscript", "Superscript", "-",
"NumberedList", "BulletedList", "-",
"Anchor", "Link", "Unlink", "-",
"HorizontalRule", "SpecialChar", "-",
"Source",
]],
# 'skin': 'office2013',
"toolbar_Custom": [
{'name': 'editing', 'items': ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'Source']},
{'name': 'basicstyles',
'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
{'name': 'paragraph',
'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-']},
'/',
{'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']},
{'name': 'insert',
'items': ['Image', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak', 'Iframe']},
{'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize']},
{'name': 'colors', 'items': ['TextColor', 'BGColor']},
'/', # put this to force next toolbar on new line
],
'toolbar': 'Custom',
'extraPlugins': ','.join([
'uploadimage',
'div',
'autolink',
'autoembed', 'embedsemantic', 'embed',
'iframe', 'iframedialog',
'autogrow',
'widget',
'lineutils',
'dialog',
'dialogui',
'elementspath'
]),
},
}
CKEDITOR_CONFIGS["richtext-plugin"] = CKEDITOR_CONFIGS["default"]
CKEDITOR_UPLOAD_PATH = 'uploads/'
#-- easy_thumbnails
@ -158,6 +179,7 @@ INSTALLED_APPS = (
'django_filters',
"content_editor",
"ckeditor",
"ckeditor_uploader",
'easy_thumbnails',
'filer',
'taggit',

View File

@ -26,6 +26,7 @@ import aircox_streamer.urls
try:
urlpatterns = aircox.urls.urls + [
path('admin/', admin.site.urls),
path('ckeditor/', include('ckeditor_uploader.urls')),
path('filer/', include('filer.urls')),
]