2

Currently struggling to generate content programmatically for the following StreamBlock:

class SpecialistStreamBlock(blocks.StreamBlock):
    accordion = SpecialistAccordionBlock()

class SpecialistAccordionBlock(BaseBlock):
    content = StreamBlock([
        ('accordion_item', StructBlock([
            ('title', blocks.CharBlock(label=_(u"Title"), max_length=255)),
            ('content', LeanRichTextBlock()), 
        ])),
    ], label=_(u"Accordion"))

In the case the structure is not nested is done using tuples like ("variablename for block definition", {dict with key value for defined fields}) but this approach doesn't seems to work in case of nested structures.

What I have tried so far without success:

accordion_block = ("accordion", {"title": "Some title",
                                           "content": ("accordion_item",
                                                       {"title": "Another title",
                                                        "content": RichText(education_block_str)})})

Vlax
  • 1,447
  • 1
  • 18
  • 24

0 Answers0