'How to break lines when using wagtail BlockQuoteBlock?

I have this model:

from wagtail.wagtailcore import blocks

class BlogPage(Page):
    date = models.DateField("Post date")
    intro = RichTextField(blank=True)
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('code', CodeBlock()),
        ('markdown', MarkDownBlock()),
        ('media', TestMediaBlock(icon='media')),
        ('blockquote', blocks.BlockQuoteBlock())
    ])

When I'm saving page with some text using blockquote I use some line breakes and even <br> tags:

enter image description here

But on the page there are no line breaks after it:

enter image description here

So how to make this work and save line breaks? I'm using wagtail 1.13.1.



Solution 1:[1]

A much easier way would be to use Django's filter linebreaksbr in your template. This converts all "\n" characters into <br> tags, so you don't have to directly inject any html when writing content.

https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#linenumbers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1