I'm trying to remove the html code that wraps the RichTextField content, I thought I could do it using "raw_data" but that doesn't seem to work. I could use regex to remove it but there must be a wagtail/django way to do this?
for block in post.faq.raw_data:
print(block['value']['answer'])
Outputs:
<p data-block-key="y925g">The time is almost 4.30</p>
Expected output (just the raw text):
The time is almost 4.30
StructBlock:
class FaqBlock(blocks.StructBlock):
question = blocks.CharBlock(required=False)
answer = blocks.RichTextBlock(required=False)