I am trying to get the CKEditor plugin, codesnippet, to work in the django admin but am unable to. CKEditor works if I don't define any CKEDIT_CONFIGS in my settings.py. It also works if take out the "extraPlugins" line (and it successfully will adjust the height and width as defined in the CKEDITOR_CONFIGS section).
I installed CKEditor using the instructions here: https://github.com/shaunsephton/django-ckeditor
CKeditor is located in /static/ckeditor and codesnippet is in /static/ckeditor/plugins/
In my settings.py
CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_JQUERY_URL = '/static/js/jquery-2.1.1.min.js'
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Full',
'height': 400,
'width': 900,
'removePlugins': 'stylesheetparser',
'extraPlugins': 'codesnippet',
},
}
My admin.py
from django.contrib import admin
from blog.models import Article, Category
from django.utils import text
from django import forms
from ckeditor.widgets import CKEditorWidget
class ArticleAdminForm(forms.ModelForm):
body = forms.CharField(widget=CKEditorWidget())
class Meta:
model = Article
I have also tried using just 'plugins' instead of 'extraPlugins' (although this not recomended), but get the same result (which is it breaks CKEditor and the filed doesn't display at all in the admin).
Thanks in advance for your help!
I have the same problem with you
Hi, I've exactly the same problem as you stated here. I got an 404 message, saying: ""GET /static/ckeditor/ckeditor/plugins/codesnippet/plugin.js?t=E7KD HTTP/1.1" 404 1752". So I checked the directory of static/ckeditor/ckeditor/plugins/codesnippet/ I indeed found no plugin.js file there. I thought this could be the problem, but when I downloaded the standalone plugin from CKeditor website, and unzipped it to my plugins folder, I still got this message even if I have this plugin.js file. I'm not sure if you have solved this problem yet. If solved, it could be nice of you to tell me how it worked out. Or perhaps my attempts might ring some bells to you too. Regards, /george
I had to as a minimum add
I had to as a minimum add Code Snippet, Widget and Line Utils in the ckeditor/plugins path to get it to work, as well as use the following setting to get the button to show up in the toolbar.
CKEDITOR_CONFIGS = {
'default': {
'toolbar':[ ['CodeSnippet', ], ],
'height': 400,
'width': 900,
'removePlugins': 'stylesheetparser',
'extraPlugins': 'codesnippet',
},
}
So once all your plugin dependencies are all installed it should work.