Django-ckeditor Error code: exportpdf-no-token-url
Asked Answered
R

2

5

I try to add ckeditor 6.1 to my form allow user to post an article. I followed a video on youtube to install and setting, I successfully add a new post using ckeditor in django admin page. But in html page, the richtext field shows but with below error. When I just render the page with GET method (have not submit the form yet), in console I always get the error : ckeditor.js:21 [CKEDITOR] Error code: exportpdf-no-token-url. and Submit also doen't work. I am new with django, this is a final shool project. I don't need to export to PDF, how can I just disable? or any idea, please help, I have stuck here for a few days.

 class Article(models.Model):
    user = models.ForeignKey("User", on_delete=models.CASCADE, related_name='post_user')
    title = models.CharField(max_length=150)
    body = RichTextUploadingField(blank=True, null=True)

class Post_Form(ModelForm):
    class Meta:
        model = Article
        exclude = ['user']
        widgets = {
            'title': TextInput(attrs={'class': 'form-control', 'id': 'title' }),
            'body': Textarea(attrs={'rows':10, 'cols':40}),
        }

views.py

def write_post(request):
    form = Post_Form(request.POST)
   
    return render(request, 'write_post.html', {
        'form': form,
    })

setting.py

CKEDITOR_CONFIGS = {
    'default': {
         'height': 800,
         'width': 1000,
    },
}

CKEDITOR_UPLOAD_PATH = "uploads/"

html

<form action="" method="POST" enctype="multipart/form-data">
        {% csrf_token %}
        {{ form.media }}
        {{ form.as_p }}
        <div type=submit class="btn btn-info">Submit</div>
</form>
Rillet answered 9/7, 2021 at 14:0 Comment(1)
Hello dear check this article ckeditor.com/docs/ckeditor4/latest/guide/… to know reason for this error and to fix this error check this post https://mcmap.net/q/2029393/-ckeditor-error-code-cloudservices-no-token-url-angular-2 – Careycarfare
R
10

I just remove plugin "exportpdf" in setting.py. It works

CKEDITOR_CONFIGS = {
    'default': {
         'height': 800,
         'width': 1200,
         "removePlugins": "exportpdf",
    }
}
Rillet answered 13/7, 2021 at 10:59 Comment(0)
C
1

developer js

any_plugin_name-no-token-url

go to file | ckeditor/config.js

add line => config.removePlugins = 'easyimage, cloudservices, exportpdf';

CKEDITOR.editorConfig = function( config ) {
    config.removePlugins = 'easyimage, cloudservices, exportpdf';
};

open consle log | πŸ˜€πŸ˜€πŸ˜πŸ˜

Chevron answered 29/7, 2022 at 9:27 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.