如何将整个内容包装在Django CKeditor中的div中并保存在数据库中?

时间:2019-01-20 16:01:08

标签: javascript python html django ckeditor

我正在使用 Django CKeditor 5.6.1 Django 2.0.9 ,并尝试将在CKeditor上编辑的内容保存到数据库中,并将其内容包装在div标签。那么,我该怎么办呢?

例如:我的CKeditor内容如下:ckeditor content 当我将其保存到数据库时,它将另存为:

 <h2><strong>My Heading</strong></h2>
 <p>This is my paragraph</p>

但是我要保存的是,将此内容包装在div标记内,并向该div添加一个类,如下所示:

<div class="ckeditor-content">
   <h2><strong>My Heading</strong></h2>
   <p>This is my paragraph</p>
</div>

0 个答案:

没有答案