From 00d21c840e37ae390808528f9d3eba71fdaeee9d Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 23:45:37 +0200 Subject: [PATCH] Disable Draftail due to wagtail#4602 --- feedler/management/commands/invalidpage.py | 31 ++++++++++++++++++++++ publichealth/settings/base.py | 8 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 feedler/management/commands/invalidpage.py diff --git a/feedler/management/commands/invalidpage.py b/feedler/management/commands/invalidpage.py new file mode 100644 index 0000000..474df36 --- /dev/null +++ b/feedler/management/commands/invalidpage.py @@ -0,0 +1,31 @@ +from django.core.management.base import BaseCommand +from django.contrib.auth.models import User +from django.test import Client + +from wagtail.core.models import Page +from wagtail.admin.views.pages import edit + +# Scans for broken editors, via +# https://github.com/wagtail/wagtail/issues/4602 + +class Command(BaseCommand): + + def handle(self, **options): + invalid_page_ids = [] + pages = Page.objects.all() + client = Client() + # use any existing super user account + user = User.objects.get(username='oleg') + client.force_login(user) + + for page in pages: + id = page.id + # print statement to assure the script is running + print(id) + url = f'/cms/pages/{id}/edit/' + try: + response = client.get(url) + except: + invalid_pages.append(id) + + print(invalid_page_ids) diff --git a/publichealth/settings/base.py b/publichealth/settings/base.py index 7e5470b..01d7518 100644 --- a/publichealth/settings/base.py +++ b/publichealth/settings/base.py @@ -43,7 +43,7 @@ INSTALLED_APPS = [ 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.contrib.search_promotions', - + 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', @@ -198,6 +198,12 @@ COMPRESS_PRECOMPILERS = [ WAGTAIL_SITE_NAME = "Public Health Schweiz" +WAGTAILADMIN_RICH_TEXT_EDITORS = { + 'default': { + 'WIDGET': 'wagtail.admin.rich_text.HalloRichTextArea' + } +} + # Puput settings PUPUT_AS_PLUGIN = True