linebreaksbr doesn't work

90 views
Skip to first unread message

___Maxim.Nesterov___

unread,
Jan 7, 2022, 8:53:14 AM1/7/22
to Django users

Hi, why linebreaksbr might not work {{somevalue | linebreaksbr}}

For example, somevalue = ‘Joel\nis a slug’, and linebreaksbr doesn’t change \n → <br>

----------------------

{% load static %}

<!DOCTYPE html>

<head>


</head>

<body>

<code>

<p>

{{somevalue | linebreaksbr}}

</p>

</code>

Muhammad Juwaini Abdul Rahman

unread,
Jan 7, 2022, 8:50:00 PM1/7/22
to django...@googlegroups.com
Try `linebreaks` instead of `linebreaksbr`.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0d366e7f-c316-4a13-ac97-947d23326105n%40googlegroups.com.

___Maxim.Nesterov___

unread,
Jan 8, 2022, 4:57:44 AM1/8/22
to Django users
i tried but didn't work

Sebastian Jung

unread,
Jan 8, 2022, 5:43:00 AM1/8/22
to django...@googlegroups.com
Hello,

Write your own filter where you replace all \n with <br>. Then you habe an idea why it would'nt work.

Regards

Reply all
Reply to author
Forward
0 new messages