Joris de Ruiter
Joris de Ruiter

Reputation: 178

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

I'm using the django CKeditor plugin. My config is as follows:

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

I need to sometimes show the simple toolbar and sometimes the full one. How can I do this?

I hope there's an option like:

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

Upvotes: 4

Views: 703

Answers (1)

Sagar Ramachandrappa
Sagar Ramachandrappa

Reputation: 1461

You can use config_name attribute to set the different toolbars.

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

Reference

Upvotes: 2

Related Questions