我正在使用带有 ckeditor 的 web2py。我想使用 SQLFORM 将富文本输入到数据库中。所以我选择 ckeditor 作为字段小部件。我已经安装了 ckeditor,这是我的 db.py:
from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
db.define_table("comtable",
Field("com_name",label="name"),
Field("com_property",label="property",requires=IS_IN_SET(['A', 'B', 'C',"D"])),Field("com_detail",label="info",type="text",widget=ckeditor.widget))
以下是我的 default.py/index:
def index():
form=SQLFORM(db.comtable,fields = ['com_name',"com_property","com_detail"])
gridform=SQLFORM.smartgrid(db.comtable)
if form.process().accepted:
response.flash="OK"
return dict(form=form,gridform=gridform)
以下是我的 index.html:
{{=form}}
{{=gridform}}
在我使用 ckeditor 小部件在文本中输入一些信息后,SQLFORM.smartgrid 将显示记录,如下所示: 在此处输入图像描述
当我单击“查看”按钮时,我得到以下信息: 在此处输入图像描述
我不想显示带有 html 标签的文本。我想获得富文本。谁能告诉我应该做什么或需要我选择另一个富文本编辑器吗?
借助以下方法,您告诉我单击“查看”按钮时可以显示富文本。但是,当我单击“编辑”按钮时,会显示 HTML 标记代码。单击“编辑”按钮时,有什么方法可以显示富文本?非常感谢。