Django 模型 - 有没有办法 select 多个页面,比如 wagtail 面板中的复选框?

Django Model-is there any way to select multiple pages like checbox in wagtail panel?

如何在 wagtail 中 select 多页而不是单页?

在我的代码中,我使用了 link_page,它只选择一页

    class Collections(models.Model):
            heading = TextField(blank=True,)
            description = RichTextField(blank=True,)
            SelectResources = SortedManyToManyField(SelectResource)
            link_page = models.ForeignKey(
                'wagtailcore.Page',
                null=True,
                blank=True,
                on_delete=models.SET_NULL,
                related_name='+'
            )

            panels = [
                FieldPanel('heading', classname="title"),
                FieldPanel('description', classname="full"),
                FieldPanel('link_page'),
            ]

            class Meta:
                abstract = True  
    class HomeCollections(Orderable, Collections):
            page = ParentalKey('Home', related_name='collections')

集合作为内联面板添加到主页

class Home(AbstractForm):    
        content_panels = AbstractForm.content_panels +[
        InlinePanel('collections', label="collections"), 
        ]

您可以创建一个 StreamField with a PageChooserBlock。像这样:

pages = StreamField([
        ('page', blocks.PageChooserBlock())
    ])