Django-CKEditor Image Upload
Asked Answered
F

3

5

I've currently installed Django-CKEditor and have my own custom toolbar.

I'm struggling to find how to enable image uploading. When clicking the Image button, I can only upload via URL. I know that, in the plugin, there are views to handle file browsing and uploading but I'm not sure how to activate or use these.

There is sparse documentation on the plugin so I am reaching out for your help!

https://github.com/shaunsephton/django-ckeditor

Foldboat answered 10/6, 2013 at 5:50 Comment(0)
F
2

As I had mentioned in my question - Django CKEditor comes with a number of URLs to handle the viewing and browsing of images. The subsequent steps to activate this with your editor require you to add a filebrowserBrowseUrl when activating the editor and setting it to the appropriate /upload/ and /browse/ URLs.

See more here:

http://www.mixedwaves.com/2010/02/integrating-fckeditor-filemanager-in-ckeditor/

Foldboat answered 17/6, 2013 at 19:47 Comment(0)
M
6

In the current version (5) you can use RichTextUploadingField instead of RichTextField, which enables uploading and browse files button.

Previously you have to install django-uploader package.

Madra answered 13/5, 2016 at 18:30 Comment(1)
when i tried to use RichTextUploadingField instead of RichTextField the text editor disappearsCrabb
S
3

settings.py

CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
CKEDITOR_UPLOAD_PATH = "uploads/"

INSTALLED_APPS = [
    'ckeditor',
    'ckeditor_uploader',
]

models.py

from django.db import models
from ckeditor_uploader.fields import RichTextUploadingField

class ModelName(models.Model):
    text_field_name = RichTextUploadingField()
Seaman answered 4/9, 2020 at 9:26 Comment(1)
dont forget out path('ckeditor/', include('ckeditor_uploader.urls')), in base urlsLoutish
F
2

As I had mentioned in my question - Django CKEditor comes with a number of URLs to handle the viewing and browsing of images. The subsequent steps to activate this with your editor require you to add a filebrowserBrowseUrl when activating the editor and setting it to the appropriate /upload/ and /browse/ URLs.

See more here:

http://www.mixedwaves.com/2010/02/integrating-fckeditor-filemanager-in-ckeditor/

Foldboat answered 17/6, 2013 at 19:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.