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?

Answers


Try to use mark output as safe using django helper method.

Example:

from django.utils.safestring import mark_safe

...

def __unicode__(self):
     ... do stuff ...
     return mark_safe(output)

Need Your Help

Help installing Symfony plugin

php plugins symfony1 installation

Hello can somebody write or point to a good symfony plugin installation tutorial. Here is the problem, I have a symfony 1.2 application and I'm trying to install the LightWindow plugin, which run on

Visual Studio (2015) fpermissive equivalent flag

c++ visual-studio-2015 compiler-flags

In VS2015 is there an equivalent flag of GCC -fpermissive?