I have this string
{{contact.info}}
The value is:
name teste\[email protected]\n(11) 11111-1111\n(0) 12312-3123\n(12) 12312-3123\n
In html I want to see it:
name teste
[email protected]<br>
(11) 11111-1111
(10) 12312-3123
(12) 12312-3123
Have any way?
Use the autoescape
template tag to escape HTML linebreak (<br />
) characters.
In addition, since you do not have html linebreak characters, you have to convert your text file newlines to HTML linebreaks, using the linebreaksbr
Django template filter, as suggested in this answer.
Your code should look like:
{% autoescape on %}
{{ contact.info | linebreaksbr }}
{% endautoescape %}
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