You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be really handy to have ListBlockFactory generate a list of N blocks, like RelatedFactoryList does, I think that's currently not possible unless we pass parameters to those sub-blocks.
The text was updated successfully, but these errors were encountered:
Hi, my use case is I want some blocks to be generated by the subfactory by default.
eg:
class MyBlockFactory(wagtail_factories.StructBlockFactory):
items = wagtail_factories.ListBlockFactory(MyBlockItemFactory, size=3)
class Meta:
model = models.MyBlock
Also having support for lambda like RelatedFactoryList might be nice:
class MyBlockFactory(wagtail_factories.StructBlockFactory):
items = wagtail_factories.ListBlockFactory(MyBlockItemFactory, size=lambda: random.randint(1, 5))
class Meta:
model = models.MyBlock
I'm thinking if individual elements were specified with items__0 etc this would still fill in up to size elements.
It'd be really handy to have ListBlockFactory generate a list of N blocks, like RelatedFactoryList does, I think that's currently not possible unless we pass parameters to those sub-blocks.
The text was updated successfully, but these errors were encountered: