简体   繁体   中英

django remove line break from textarea python

i have a text area tha is tinymce application that devolve the text introduce in html. so if i introduce this: I, this is an example. that i recive, <p> I, this is an example.</p> in my view i remove the html tags, and if the tag are " p " than replace for an \\n . result: I, this is an example.\\n but if i introduce this:

I,

this is an example.

this return:

<p> I,</p>
<p>this is an example.</p>

result:

I,\n
this is an example.\n

I want to remove the line break, so the result are:I,\\n this is an example.\\n

I would recommend fixing the <p> tag issue on the client side, as you can configure tinymce not to use <p> tags at all:

tinyMCE.init({
        ...
        forced_root_block : false
});

http://www.tinymce.com/wiki.php/Configuration:forced_root_block

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM