【发布时间】:2017-10-27 02:25:43
【问题描述】:
我使用bottle和peewee作为后端框架,sqlite3作为数据库。而summernote是最前面的文本编辑器。成功将代码保存到数据库中,但从数据库中检索时无法显示文本。
数据库数据: The Draft column is the html
源码:
正面:
$('#summernote').summernote("code", "{{content}}");
后端:
template('apps_post_editer', appName='Post New', pid=newPost.id, title=('' if newPost.title is None else str(newPost.title)), content=('' if newPost.draft is None else unicode(str(newPost.draft), "utf-8")))
一开始我以为是编码问题,所以我用unicode转了utf-8里面的值,但是不行。而且也只失败了str(newPost.draft)
结果: You can see that the html code is not converted
问题: 为什么会这样?有什么解决办法吗?
非常感谢。
更新:抱歉这是我的第一个问题,不知道为什么图片不显示...请点击链接获取更多详细信息... 好的...需要 10 声望
【问题讨论】:
标签: python bottle summernote