django - 使用 Django CKeditor,如何在不同的字段上加载不同的工具栏?

标签 django ckeditor django-ckeditor

我正在使用 django CKeditor 插件。我的配置如下:

CKEDITOR_CONFIGS = {
'default': {
    'skin': 'moono', #'office2013'
    'toolbar': 'Custom', #selects from below
    'toolbar_Custom': [
          ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript']
    ],
'toolbar_simple': {
    'skin': 'moono',
    'toolbar': 'Custom',
    'toolbar_Custom': [
         ['Bold', 'Italic', 'Underline'],
         ['NumberedList', 'BulletedList'],
    ],
},
'toolbar_basic':  {
    'toolbar': 'Basic'
},
'toolbar_full': {
    'toolbar': 'full',
},
}

我有时需要显示简单的工具栏,有时需要显示完整的工具栏。我该怎么做?

我希望有这样的选项:

directions_car = RichTextField("Directions by car", max_length=1000, blank=False, default="", uses="toolbar_Custom")

最佳答案

您可以使用config_name 属性来设置不同的工具栏。

directions_car = RichTextField("Directions by car", max_length=1000, blank=False, default="", config_name="toolbar_Custom")

Reference

关于django - 使用 Django CKeditor,如何在不同的字段上加载不同的工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40408029/

相关文章:

javascript - 如何让我的 django-ckeditor 安装被识别?

python - Django-ckeditor所有用户的上传权限;添加滚动条; & 根据屏幕尺寸自动调整编辑器宽度

django - 了解多值字段的 order_by (Django)

javascript - 将信息从 javascript 传递到 django 应用程序并返回

python-3.x - Django channel 错误 "took too long to shut down and was killed."

jquery - 更改 CKEditor 标题的字体并将其反射(reflect)在下拉菜单中

django - 如何检查是否在django模板中选中了复选框

twitter-bootstrap - CKEditor 4 - 链接对话框在 Twitter Bootstrap 模式中不起作用

javascript - 即使在 Page.LoadComplete() 之后页面仍在加载

javascript - django-ckeditor:在哪里存储 config.js?