I would like to introduce plain html without the need of any Editor (wymeditor or tinymce). I know Django-CMS comes with Wymeditor but my problem is that copy & paste text is annoying. Even if there is no format, Wymeditor likes to add style to the paragraphs when I simply copy (without any format). Sometimes, I don't even need another paragraph inside my placeholders (and it messes with my style).
Is there a way to get rid-off the editor? Moreover, is there a way to get rid-off the editor for a particular placeholder? Sometimes I do need it.
NOTE: I know that I can create my own plugin with a field.textfield
(and it doesn't use the editor), but I would like to use the same plugin because if I change the plugin I would have to move all the texts manually in the database (production and development).
I found my solution. Basically, I override the plugin for the TextPlugin. I added this to my
cms_plugins.py
:Notice:
I unregister the original
TextPlugin
(plugin_pool.unregister_plugin(TextPluginCMS)
) and register a newTextPlugin
that simply inherits fromCMSPluginBase
. That will get rid off the annoying Editor.I register another
EditorTextPlugin
that inherits from the originalTextEditor
(from cms.plugins.text.cms_plugins import TextPlugin as TextPluginCMS
). I just rewrite the name of the plugin.With this, all the existent text plugins won't use any editor by default. Moreover, I am still able to use the Editor with the
EditorTextPlugin
.Finally, I can control which plugins use the editor with the
CMS_PLACEHOLDER_CONF
in the settings.py:No boring migrations needed. When I want to use the Editor, I just add a new
EditorTextPlugin
and copy and paste the content.EDITS
As @Melissa pointed out in the comments. You do need to add the template
text.html
with{{instance.body|safe}}
into the the templates directory.As of django-cms 3.x, the Text model is imported like:
from djangocms_text_ckeditor.models import Text
. Thanks @northben