You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportError: cannot import name 'UserPagePermissionsProxy' from 'wagtail.models'
and here how it is explained to be fixed:
The wagtail.models.UserPagePermissionsProxy class and get_pages_with_direct_explore_permission, get_explorable_root_page and users_with_page_permission functions have been removed; equivalent functionality exists in the wagtail.permission_policies.pages.PagePermissionPolicy class.
here how it should be the code:
fromwagtail.permission_policies.pagesimportPagePermissionPolicy@classmethoddefget_pages_with_reviews_for_user(cls, user):
""" Return a queryset of pages which have reviews, for which the user has edit permission """permission_policy=PagePermissionPolicy()
reviewed_pages=cls.objects.order_by("-created_at").values_list(
revision_page_fk_relation, "created_at"
)
# Annotate datetime when a review was last created for this pagelast_review_requested_at=Case(
*[When(pk=pk, then=Value(created_at)) forpk, created_atinreviewed_pages],
output_field=models.DateTimeField(),
)
return (
permission_policy.instances_user_has_permission_for(user, "change")
.filter(pk__in=(page[0] forpageinreviewed_pages))
.annotate(last_review_requested_at=last_review_requested_at)
.order_by("-last_review_requested_at")
)
The text was updated successfully, but these errors were encountered:
this is the error that is appearing:
and here how it is explained to be fixed:
The wagtail.models.UserPagePermissionsProxy class and get_pages_with_direct_explore_permission, get_explorable_root_page and users_with_page_permission functions have been removed; equivalent functionality exists in the wagtail.permission_policies.pages.PagePermissionPolicy class.
here how it should be the code:
The text was updated successfully, but these errors were encountered: