2

I have a structblock as below:

 image = StructBlock([
        ('file', ImageChooserBlock()),
        ('caption', RichTextBlock( classname='caption'  )),

    ])

But on the frontend template {{item.value.caption}} produces a div with class 'rich-text'.

Am I missing something?

I am using wagtail 1.13 with django 1.11.6 ( python 3.6 )

1 Answer 1

3

The classname keyword argument on a block only affects the form field as displayed within the Wagtail admin - it doesn't have any effect on the front-end template rendering.

The <div class="rich-text"> element around rich text is hard-coded and can't be customised - if you need a custom class name, it's suggested that you add an extra wrapper element around it on your template, and apply styles based on that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.