Django/Wagtail How to get multiline help_text

When working in the admin portal I have found a way to get multi-line help text. It took a long time to find this answer so I figured I would post about it for others to fine.

The secret is the mark_safe

from django.utils.safestring import mark_safe

item = models.IntegerField(blank=True, null=True, help_text=mark_safe('Line 1 <br />Line 2))

Nice post. To even go further you can try markdown for this.

mark_safe(render_markdown('Line 1. \nLine 2.  \n**Important** thing.'))


Back to Top