@hooks.register("construct_explorer_page_queryset")defexclude_fund_pages(parent_page,pages,request):# Don't allow editors to access the Apply pages in the explorer unless they know whats upifnotrequest.user.is_superuser:pages=pages.not_descendant_of(ApplyHomePage.objects.first(),inclusive=True)returnpages
@hooks.register("construct_main_menu")defhide_explorer_menu_item_from_frank(request,menu_items):ifnotrequest.user.is_superuser:groups=list(request.user.groups.all())# If the user is only in the staff group they should never see the explorer menu itemiflen(groups)==1andgroups[0].name==STAFF_GROUP_NAME:menu_items[:]=[itemforiteminmenu_itemsifitem.name!="explorer"]