1

In admin all CKEditor option is showing and working properly. I can upload image in main admin dashboard. But in App in Image "Uoload" option is not showing. Please see those images than you have a clear view,

Image 1 enter image description here

Image 2 enter image description here

Others option is working properly without image Upload.

settings.py

THIRD_PARTY_APPS = [
    'widget_tweaks',
    'ckeditor',
    'ckeditor_uploader',
]

INSTALLED_APPS += THIRD_PARTY_APPS + LOCAL_APPS

# CkEditor Upload path
CKEDITOR_UPLOAD_PATH = 'uploads/'

# CkEditor Custom Configuration
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'Custom',
        'width': 680,
        'extraPlugins': ','.join(['codesnippet']),
    },
}

template.html

<form method="post" enctype="multipart/form-data">{% csrf_token %}>
{{ form.media }}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
4

2 回答 2

0

我刚刚在 django-ckeditor 的 6.1.0 版本中遇到了同样的问题。仔细考虑之后,查看项目的 github 代码,显然有一个新的表单字段可以解决这个问题,至少对我来说,如果它对我有用的话。

from django import forms
from ckeditor.fields import RichTextFormField
from ckeditor_uploader.fields import RichTextUploadingFormField



class CkEditorForm(forms.Form):
    ckeditor_standard_example = RichTextFormField()
    ckeditor_upload_example = RichTextUploadingFormField(
        config_name="my-custom-toolbar"
    )

代码官方repo ckeditor

于 2021-06-15T18:08:54.433 回答
0

第 1步: 转到 settings.py 并添加 -> X_FRAME_OPTIONS = 'SAMEORIGIN'

step2 转到您的 forms.py -> 这里不需要额外的小部件。 第2步

于 2018-12-09T06:35:46.570 回答