0👍
In Django, strings are sanitized before being output onto a webpage by default. I suspect Django-CMS treats plugins like unsanitized user data, so the Django Template system strips out an HTML characters from the plugin.
Django Template Docs: http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs
Note the very first item, autoescape. I suspect plugins are being run through that filter.
Sorry, I don’t have any more specifics. I’m not a Django-CMS guy.
3👍
I believe that in Django CMS, the HTML cleaning happens before the Django Template layer. I took a look in my database and found that a “” tag in my HTML was being sanitized.
I think this happens at the Plugin (the phrase Django CMS uses for its bits of content) layer. I’m assuming that to add HTML, you’re using the Text plugin. Looking at the source for the clean
method of the Text plugin model:
def clean(self):
self.body = clean_html(self.body, full=False)
It calls cms.utils.clean_html
, which in turn uses html5lib
to sanitize the HTML.
One way to work around this would be to create a custom plugin that inherits from the Text
plugin and re-implements the clean
method that doesn’t do this sanitization.
- [Django]-Multiple images in django form with multiupload
- [Django]-Is is possible to have the Django slugfield unique per user or other model
- [Django]-Jinja2 templating with components? blocks? templates?