我使用的是django-ckeditor == 5.3.1和django == 1.11.2。我需要上传非图像文件。我需要上传pdf文件。但我无法找到解决方案(例如编辑器面板中的pdf图标)。
请提示我在哪里找到这个。
我的模特:
from ckeditor_uploader.fields import RichTextUploadingField
class Event(models.Model):
title = models.CharField(max_length=500)
date = models.DateField()
text = RichTextUploadingField()
urls.py
urlpatterns += [
url(r'^admin/', include(admin.site.urls)),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
]
settings.py
CKEDITOR_JQUERY_URL = 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'
CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_ALLOW_NONIMAGE_FILES = True
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Simple',
'toolbar_Simple': [
['Bold', 'Italic', 'Underline'],
['Link', 'Unlink'],
['Image', 'Update', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'uploadwidget'],
],
'autoParagraph': False,
'shiftEnterMode': 2,
'enterMode': 2,
},
}