23👍
✅
You almost made it. You need to use mark_safe.
In your case, this is what you will have:
from django.utils.safestring import mark_safe
messages.error(request, mark_safe("ERROR: upload failed.<br/>Try again"))
👤Alan
0👍
This might not be a perfect solution for your case, but you can call it two times:
messages.error(request, 'ERROR: upload failed.')
messages.error(request, 'Try again')
Instead of one message of two lines, you’ll output two messages perfectly split.
- Django + virtualenv + gunicorn – No module named django.core.wsgi?
- How can I add a test method to a group of Django TestCase-derived classes?
- Django filter a ForeignKey field when it is null
Source:stackexchange.com