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

With Django CKeditor, how to load different toolbars on different fields?

我正在使用 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