Django CKEditor django admin 的不同工具栏设置

Django CKEditor different toolbar settings for django admin

有什么方法可以使用 django-ckeditor 为 Django 管理面板设置不同的 CKEditor 工具栏设置。

我在 settings.py 中的工具栏设置如下所示

        'toolbar_Custom': [
            ['Format', 'Bold', 'Italic', 'Link', 'NumberedList', 'BulletedList', 'Table', 'HorizontalRule', 'Image', 'Youtube', 'Smiley',
             'Undo', 'Redo', 'Preview', 'Source'],
        ],

我只想设置 ['Format'、'Bold'、'Italic'、'Link'、'Undo'、'Redo']管理页面。

是的,你可以。参考 here.

在settings.py中:

CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': 'Custom',
        'toolbar_Custom': 
            ['Format', 'Bold', 'Italic', 'Link', 'NumberedList', 'BulletedList', 'Table', 'HorizontalRule', 'Image', 'Youtube', 'Smiley',
             'Undo', 'Redo', 'Preview', 'Source'],
    },
    'non_admin':{
        'toolbar': 'Custom',
        'toolbar_Custom': 
            ['Format', 'Bold', 'Italic', 'Link', 'Undo', 'Redo'],
    },
}

并在 models.py 中:

content = RichTextField(config_name='non_admin')