Raise warning when editing a page that's in the legacy moderation system

pull/10968/head
Sage Abdullah 2023-09-28 16:13:08 +01:00
rodzic e7595ab91d
commit 5f6366c494
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -1,4 +1,5 @@
import json
import warnings
from urllib.parse import quote
from django.conf import settings
@ -35,6 +36,7 @@ from wagtail.models import (
PageSubscription,
WorkflowState,
)
from wagtail.utils.deprecation import RemovedInWagtail60Warning
from wagtail.utils.timestamps import render_timestamp
@ -60,6 +62,20 @@ class EditView(TemplateResponseMixin, ContextMixin, HookResponseMixin, View):
buttons=buttons,
)
page_type = self.page._meta.verbose_name
page_title = self.page.get_admin_display_title()
warnings.warn(
f"The {page_type} '{page_title}' is undergoing moderation in "
"the legacy moderation system. Complete the moderation of this page "
"before upgrading Wagtail. Support for the legacy moderation system "
"will be completely removed in a future release. For more details, "
"refer to "
"https://docs.wagtail.org/en/stable/releases/2.10.html#move-to-new-configurable-moderation-system-workflow",
RemovedInWagtail60Warning,
stacklevel=2,
)
def add_save_confirmation_message(self):
if self.is_reverting:
message = _(