Reputation: 367
Could someone please guide me in the proper direction to install CKEditor in my Django project? I'm very new at this, so the more thorough of a explanation, the much more helpful it will be for me.
I found this link, but it isn't working very well for me: http://docs.ckeditor.com/#!/guide/dev_installation.
Thank you very much!
Upvotes: 1
Views: 5299
Reputation: 4000
pip install ckeditor
CKEDITOR_UPLOAD_PATH = root('uploads')
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Advanced',
'width': 758,
'height': 300,
},
}
Create a folder uploads inside the project
Add this url in your main urls.py
url(r'^ckeditor/', include('ckeditor.urls')),
Add this in to your models.py
from ckeditor.fields import RichTextField
content = RichTextField(verbose_name='BlogContent',null=True,blank=True)
Make sure do python manage.py collectstatic
before running your project.
Upvotes: 0
Reputation: 51978
There is another way of integrating CKeditor to Django by using Javascript version of CKeditor.
Download ckeditor from http://ckeditor.com/download and extract the zip file, put the unzipped folder in static root. add ckeditor static files to your template like:
<script src="{{STATIC_URL}}ckeditor/ckeditor.js"></script>
In your form, add html class like this:
class SomeForm(forms.Form):
text = forms.CharField(widget = forms.Textarea(attr={'class':'richtexteditor'})
And to make this rich text editor visible, add the following line your template:
<script>
CKEDITOR.replace( '.richtexteditor' );
</script>
Upvotes: 6