Commits

Melevir  committed d0dd5c9 Draft

Added configs to cked widget.

  • Participants
  • Parent commits 9528355

Comments (0)

Files changed (1)

File cked/widgets.py

         js = (settings.STATIC_URL + 'cked/ckeditor/ckeditor.js',)
 
     def __init__(self, *args, **kwargs):
+        config_name = kwargs.pop('config_name', 'default')
         super(CKEditorWidget, self).__init__(*args, **kwargs)
         # Use default config
         self.options = default_settings.CKEDITOR_DEFAULT_OPTIONS.copy()
 
         # If CKEDITOR_OPTIONS presented in settings, use it!
-        options = getattr(settings, 'CKEDITOR_OPTIONS', None)
+        general_options = getattr(settings, 'CKEDITOR_OPTIONS', None)
+
+        if config_name in general_options:
+            options = general_options[config_name]
 
         if options is not None:
             if isinstance(options, dict):
             'id': final_attrs['id'],
             'options': json_encode(self.options)})
         )
+
+