diff --git a/opentech/apply/home/wagtail_hooks.py b/opentech/apply/home/wagtail_hooks.py new file mode 100644 index 0000000000000000000000000000000000000000..9de9cfd7c9d95d1840f9467d8533ea305c787f24 --- /dev/null +++ b/opentech/apply/home/wagtail_hooks.py @@ -0,0 +1,12 @@ +from wagtail.core import hooks + +from .models import ApplyHomePage + + +@hooks.register('construct_explorer_page_queryset') +def exclude_fund_pages(parent_page, pages, request): + # Don't allow editors to access the Apply pages in the explorer unless they know whats up + if not request.user.is_superuser: + pages = pages.not_ancestor_of(ApplyHomePage.objects.first(), inclusive=True) + + return pages