From f055517cc10908077fdeb06862db8a045ccc5200 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 16 Apr 2023 15:04:51 +0100 Subject: [PATCH] Update to Wagtail 4.1 --- etc/crontab | 1 + requirements.txt | 18 ++++++----- .../0004_alter_footersetting_icons.py | 30 +++++++++++++++++++ website/common/models.py | 3 +- website/common/tests/test_pages.py | 4 +-- website/common/tests/test_views.py | 2 +- website/search/tests.py | 2 +- 7 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 website/common/migrations/0004_alter_footersetting_icons.py diff --git a/etc/crontab b/etc/crontab index 8807b4a..f89adb1 100644 --- a/etc/crontab +++ b/etc/crontab @@ -1,5 +1,6 @@ @weekly ./manage.py update_index @daily ./manage.py clearsessions @daily ./manage.py update_unsplash_photos +@daily ./manage.py rebuild_references_index @weekly ./manage.py refresh_spotify_playlists */10 * * * * ./manage.py publish_scheduled_pages diff --git a/requirements.txt b/requirements.txt index b5abbac..ba8da3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,27 +1,26 @@ Django==4.0.10 -wagtail==3.0.3 +wagtail==4.1.4 django-environ==0.9.0 whitenoise[brotli]==6.4.0 -Pygments==2.14.0 -beautifulsoup4==4.9.3 +Pygments==2.15.0 +beautifulsoup4==4.11.2 lxml==4.9.1 requests==2.28.1 -wagtail-generic-chooser==0.5 +wagtail-generic-chooser==0.5.1 django-rq==2.7.0 django-redis==5.2.0 -wagtail-draftail-snippet==0.4.2 gunicorn==20.1.0 psycopg2==2.9.5 djangorestframework django-htmx==1.14.0 -wagtail-metadata==4.0.2 +wagtail-metadata==4.0.3 humanize==4.6.0 django-plausible==0.4.0 sentry-sdk==1.15.0 django-sri==0.5.0 -wagtail-2fa==1.6.3 +wagtail-2fa==1.6.5 django-health-check==3.17.0 -wagtail-autocomplete==0.9.0 +wagtail-autocomplete==0.10.0 Wand==0.6.10 django3-cache-decorator==0.5.2 django-cors-headers==3.14.0 @@ -36,3 +35,6 @@ PyYAML # Use custom `wagtail-favicon` with performance improvements git+https://github.com/RealOrangeOne/wagtail-favicon@4586efaac746085338fc7d61713006d9adc62d2e + +# Use custom `wagtail-draftail-snippet` with support for Wagtail 4.1 +git+https://github.com/RealOrangeOne/wagtail-draftail-snippet@0924ab12b1ca205b94ccd9a34ecc446d7ac422e5 diff --git a/website/common/migrations/0004_alter_footersetting_icons.py b/website/common/migrations/0004_alter_footersetting_icons.py new file mode 100644 index 0000000..6a51184 --- /dev/null +++ b/website/common/migrations/0004_alter_footersetting_icons.py @@ -0,0 +1,30 @@ +# Generated by Django 4.0.10 on 2023-04-16 13:49 + +import wagtail.fields +import wagtail.snippets.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("common", "0003_alter_contentpage_body_alter_listingpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="footersetting", + name="icons", + field=wagtail.fields.StreamField( + [ + ( + "icon", + wagtail.snippets.blocks.SnippetChooserBlock( + "contact.OnlineAccount", icon="user" + ), + ) + ], + use_json_field=True, + ), + ), + ] diff --git a/website/common/models.py b/website/common/models.py index 38fabfe..90ae150 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -266,7 +266,8 @@ class ReferralLink(models.Model, index.Indexed): @register_setting(icon="arrow-down") class FooterSetting(BaseSetting): icons = StreamField( - [("icon", SnippetChooserBlock("contact.OnlineAccount", icon="user"))] + [("icon", SnippetChooserBlock("contact.OnlineAccount", icon="user"))], + use_json_field=True, ) panels = [FieldPanel("icons")] diff --git a/website/common/tests/test_pages.py b/website/common/tests/test_pages.py index eead1d6..0bad11b 100644 --- a/website/common/tests/test_pages.py +++ b/website/common/tests/test_pages.py @@ -35,7 +35,7 @@ class ContentPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(34): + with self.assertNumQueries(40): self.client.get(self.page.url) @@ -52,7 +52,7 @@ class ListingPageTestCase(TestCase): ContentPageFactory(parent=cls.page) def test_accessible(self) -> None: - with self.assertNumQueries(38): + with self.assertNumQueries(44): response = self.client.get(self.page.url) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.context["listing_pages"]), 2) diff --git a/website/common/tests/test_views.py b/website/common/tests/test_views.py index 8dfa488..a6de697 100644 --- a/website/common/tests/test_views.py +++ b/website/common/tests/test_views.py @@ -22,7 +22,7 @@ class Error404PageTestCase(TestCase): ) def test_queries(self) -> None: - with self.assertNumQueries(21): + with self.assertNumQueries(27): self.client.get(self.url) diff --git a/website/search/tests.py b/website/search/tests.py index 2bd554b..d9dab95 100644 --- a/website/search/tests.py +++ b/website/search/tests.py @@ -89,7 +89,7 @@ class SearchPageResultsTestCase(TestCase): ) def test_too_high_page(self) -> None: - with self.assertNumQueries(46): + with self.assertNumQueries(52): response = self.client.get( self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true" )