Reputation: 8023
I have a content_panels
definition that includes this:
MultiFieldPanel(
[
InlinePanel('related_resource_type', label="Resource Type",),
],
heading="Resource Type",
classname="collapsible"
),
This references
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"
)
Is there a way in Wagtail to require at least one RelatedResourceType
? Preferably I would also have the ability to specify a minimum number of RelatedResourceTypes
. I cannot find in the documentation how to specify required panels. Thanks in advance.
Upvotes: 1
Views: 169
Reputation: 4138
InlinePanel takes an optional min_num
argument.
Finally, min_num and max_num allow you to set the minimum/maximum number of forms that the user must submit
Upvotes: 2