(wagtail 1.9) I created a RichTextField (role in class person) and a FieldPanel for this field. In the template is {{ person.role }} . wagtail generates "<p>the role text</p>".
When does wagtail create <p> ... </p> for a RichTextField?
You should use the |richtext filter when outputting rich text content in templates:
{% load wagtailadmin_tags %}
...
{{ person.role|richtext }}
(This is necessary because rich text data is stored internally as a non-HTML format, which preserves references to other Wagtail pages and objects, e.g. <a linktype="page" id="123">some other page</a>. The |richtext filter converts this to "true" HTML.)
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