[Answered ]-Wagtail add RawHTMLBlock to field in model

1👍

Blocks are not valid outside of StreamField. To achieve the same thing as RawHTMLBlock in a model field, define it as a TextField:

code_text = models.TextField(blank=True)

Then, when outputting it on a template, use Django’s |safe filter to disable the HTML escaping that is applied as standard:

{{ header.code_text|safe }}
👤gasman

Leave a comment