1

The title says it all, I haven't been able to find any other information online. I'm wondering if it is possible for me to get

secondary_links = StreamField([
    ('Page', SerialisedPageChooserBlock())])

to accept exactly two blocks.

jsindos
  • 459
  • 6
  • 22

1 Answers1

5

Yes, this is possible as of Wagtail 1.12, with the min_num and max_num properties on StreamBlock:

secondary_links = StreamField(
    StreamBlock([
        ('Page', SerialisedPageChooserBlock())
    ], min_num=2, max_num=2)
)
Rehan Haider
  • 893
  • 11
  • 26
gasman
  • 23,691
  • 1
  • 38
  • 56