0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Do not use Site.find_for_request() in the admin

This commit is contained in:
Dan Braghis 2020-07-18 10:36:49 +01:00 committed by Matt Westcott
parent c8a8689cee
commit 441bcde1ad

View File

@ -16,7 +16,7 @@ from wagtail.admin.filters import (
LockedPagesReportFilterSet, SiteHistoryReportFilterSet, WorkflowReportFilterSet, LockedPagesReportFilterSet, SiteHistoryReportFilterSet, WorkflowReportFilterSet,
WorkflowTasksReportFilterSet) WorkflowTasksReportFilterSet)
from wagtail.core.models import ( from wagtail.core.models import (
Page, PageLogEntry, Site, TaskState, UserPagePermissionsProxy, WorkflowState) Page, PageLogEntry, TaskState, UserPagePermissionsProxy, WorkflowState)
class Echo: class Echo:
@ -383,7 +383,8 @@ class LogEntriesView(ReportView):
q = Q( q = Q(
page__in=UserPagePermissionsProxy(self.request.user).explorable_pages().values_list('pk', flat=True) page__in=UserPagePermissionsProxy(self.request.user).explorable_pages().values_list('pk', flat=True)
) )
root_page_permissions = Site.find_for_request(self.request).root_page.permissions_for_user(self.request.user)
root_page_permissions = Page.get_first_root_node().permissions_for_user(self.request.user)
if ( if (
self.request.user.is_superuser self.request.user.is_superuser
or root_page_permissions.can_add_subpage() or root_page_permissions.can_edit() or root_page_permissions.can_add_subpage() or root_page_permissions.can_edit()