djangodjango-ckeditor

Django-ckeditor Error code: exportpdf-no-token-url


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>

Solution

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

    CKEDITOR_CONFIGS = {
        'default': {
             'height': 800,
             'width': 1200,
             "removePlugins": "exportpdf",
        }
    }