需要至少一个 MultiFieldPanel 对象 [wagtail]

Require at least one MultiFieldPanel object [wagtail]

我有一个 content_panels 定义,其中包括:

MultiFieldPanel(
    [
        InlinePanel('related_resource_type', label="Resource Type",),
    ],
    heading="Resource Type",
    classname="collapsible"
),

本文引用

class RelatedResourceType(Orderable):
    page = ParentalKey('ShopPage', related_name='related_resource_type')
    resource_type = models.CharField(
        max_length=16,
        choices=shopchoices.RESOURCE_TYPE_CHOICES,
        default="shop"
    )

在 Wagtail 中有没有办法要求至少一个 RelatedResourceType?最好我还能够指定 RelatedResourceTypes 的最小数量。我在文档中找不到如何指定所需的面板。提前致谢。

InlinePanel 有一个可选的 min_num 参数。

Finally, min_num and max_num allow you to set the minimum/maximum number of forms that the user must submit

来自http://docs.wagtail.io/en/v1.10.1/reference/pages/panels.html?highlight=min#inline-panels-and-model-clusters