Please review my Django’s view snippet;
# notification
seeker=Seeker.objects.get(id=seeker_id)
donor=Profile.objects.get(user=request.user)
new_notification = Notification.objects.create(user=seeker.seeker,
message=f"Congratulations !, {request.user.username} is willing to donate {seeker.b_group_required} to the blood request you made at VitalFlows. Contact with {request.user.username} to proceed further. Here are the details of the donor . \nPhone No : {donor.contact_number} \nEmail : {request.user.email} .\nHappy Blood Seeking! ")
It creates and saves a new notification. Notice the message field contains newline characters i.e., \n.
A template, notifications.html, is provided with the notifications retrieved and tries to render the notifications. For allowing the template render the new line character correctly, I am using linebreaksbr filter which is not responding as expected.
<td>
{% autoescape on %}
{{ notification.message|linebreaksbr|force_escape}}. {{ notification.timestamp}}
{% endautoescape %}%}
</td>
Please guide me.