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

View File

@ -122,19 +122,40 @@ except:
#-- django-CKEditor #-- django-CKEditor
CKEDITOR_CONFIGS = { CKEDITOR_CONFIGS = {
"default": { "default": {
"toolbar": "Custom",
"format_tags": "h1;h2;h3;p;pre", "format_tags": "h1;h2;h3;p;pre",
"toolbar_Custom": [[ # 'skin': 'office2013',
"Format", "RemoveFormat", "-", "toolbar_Custom": [
"Bold", "Italic", "Subscript", "Superscript", "-", {'name': 'editing', 'items': ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'Source']},
"NumberedList", "BulletedList", "-", {'name': 'basicstyles',
"Anchor", "Link", "Unlink", "-", 'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
"HorizontalRule", "SpecialChar", "-", {'name': 'paragraph',
"Source", '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 #-- easy_thumbnails
@ -158,6 +179,7 @@ INSTALLED_APPS = (
'django_filters', 'django_filters',
"content_editor", "content_editor",
"ckeditor", "ckeditor",
"ckeditor_uploader",
'easy_thumbnails', 'easy_thumbnails',
'filer', 'filer',
'taggit', 'taggit',

View File

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