C
C
codecreator2018-07-28 13:29:12
Django
codecreator, 2018-07-28 13:29:12

How to keep line breaks?

There is a contenteditable div in which the text is written. How to save text without losing line breaks?
I tried to save the entire html, remove tags, except for hyphens, and display in the template using safe, but nothing good came of it.
When replacing with '\n' divs, which are created when wrapping in contenteditable, the text is saved with wraps, but is displayed without.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Web Dentist, 2018-08-06
@kgb_zor

{{ foo.text|linebreaksbr }}

V
Vadim Shatalov, 2018-07-30
@netpastor

https://docs.djangoproject.com/en/1.11/ref/templat...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question