我如何从 Wagtail 页面的 QuerySets 中识别私有页面和 public 页面?

How could I recognize private pages and public pages from QuerySets of Wagtail page?

当我从 wagtail 制作一个 API 时,我得到了 QuerySets(包含私人页面和 public 页面),那么我如何识别私人页面和 public 页面?数据库表没有归档来识别它。我知道如何获取私有查询集和 public 查询集,用例如下:

Page.objects.filter().all().public().live() Page.objects.filter().all().not_public().live()

是否有任何我可以使用的文件,例如 page.private 来获取此属性?

页面模型有一个 get_view_restrictions() 方法,该方法 returns 一个应用于页面的限制查询集;如果为空,则页面为 public.

is_private = page.get_view_restrictions().exists()