Django CMS: Custom plugin preview in editor escaping some characters
I made a custom plugin for Django CMS, and as is the default behavior, the preview icon of the text field showed the returned value of the model's __unicode__(self) as the icon in the WYSIWYG view of the editor:
(where "Email address" is the name of the custom plugin.) However, if the __unicode__(self) method of the plugin returns anything with characters such as ', &, or < >, they get escaped in the preview:
I'm pretty sure the preview uses the alt text property of the plugin instance. The closest thing to people having the same issue I can find is this report, as well as this suggested fix, but neither solution causes any change in the alt text behavior, as far as I can tell.
Basically, even though the plugin's output on the actual page isn't affected, I'd like to be able to display characters like ', &, <, and >in the editor preview. Is this possible?
Try to use mark output as safe using django helper method.
from django.utils.safestring import mark_safe ... def __unicode__(self): ... do stuff ... return mark_safe(output)