I have a model with multiline text fields, which was input from a textarea
.
Now I want to render the field, but don't want to use <pre>
tag.
I just want to replace the new line with <br/>
, and I found the linebreakbr
filter.
But I also want to replace space with
. Seemed not included in the documentation.
Can anyone help?
For replacing a space with   , you may use one of following Template Tags based solution:
1) nbsp filter Replaces usual spaces in string by non breaking spaces
2) Regular Expression Replace Template Filter This will perform a regular expression search/replace on a string in your template.
3) Stackoverflow post, @Paolo Bergantino's answer Suggests to make a custom template tag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With