diff --git a/wagtail/wagtailcore/query.py b/wagtail/wagtailcore/query.py index faffa1a904..3365700c93 100644 --- a/wagtail/wagtailcore/query.py +++ b/wagtail/wagtailcore/query.py @@ -16,6 +16,15 @@ class PageQuerySet(QuerySet): def not_live(self): return self.exclude(self.live_q()) + def page_q(self, other): + return Q(id=other.id) + + def page(self, other): + return self.filter(self.page_q(other)) + + def not_page(self, other): + return self.exclude(self.page_q(other)) + def descendant_of_q(self, other): return Q(path__startswith=other.path) & Q(depth__gt=other.depth)