小编yến*_*yễn的帖子

Django-ckeditor 错误代码:exportpdf-no-token-url

我尝试将 ckeditor 6.1 添加到我的表单中,以允许用户发布文章。我按照 youtube 上的视频进行安装和设置,我成功地在 django 管理页面中使用 ckeditor 添加了新帖子。但在 html 页面中,富文本字段显示,但出现以下错误。当我只是使用 GET 方法渲染页面时(尚未提交表单),在控制台中我总是收到错误:ckeditor.js:21 [CKEDITOR] 错误代码:exportpdf-no-token-url。和提交也不起作用。我是 django 的新手,这是最后一个学校项目。我不需要导出为 PDF,如何禁用?或者任何想法,请帮忙,我已经在这里呆了几天了。

 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}),
        }
Run Code Online (Sandbox Code Playgroud)

视图.py

def write_post(request):
    form = Post_Form(request.POST)
   
    return render(request, 'write_post.html', {
        'form': form,
    })
Run Code Online (Sandbox Code Playgroud)

设置.py

CKEDITOR_CONFIGS = {
    'default': {
         'height': 800,
         'width': …
Run Code Online (Sandbox Code Playgroud)

django django-ckeditor

4
推荐指数
1
解决办法
5783
查看次数

标签 统计

django ×1

django-ckeditor ×1