dtar
dtar

Reputation: 1669

Django CKEditor different toolbar settings for django admin

Is there any way to set the different CKEditor toolbar settings for the Django Admin Panel with django-ckeditor.

My toolbar settings in settings.py looks as below

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

I want to set just ['Format', 'Bold', 'Italic', 'Link', 'Undo', 'Redo'] for non-admin pages.

Upvotes: 3

Views: 1140

Answers (1)

ha-neul
ha-neul

Reputation: 3248

Yes, you can. Reference here.

In 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'],
    },
}

and in models.py:

content = RichTextField(config_name='non_admin')

Upvotes: 2

Related Questions