Reputation: 69
(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?
Upvotes: 4
Views: 2289
Reputation: 25227
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.)
Upvotes: 7