Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8019] wagtail incremental upgrade from 4.1.6 to 5.2 #2554

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ adhocracy+ is designed to make online participation easy and accessible to every
* nodejs (+ npm)
* python 3.x (+ venv + pip)
* libpq (only if postgres should be used)
* sqlite3 [with JSON1 enabled](https://code.djangoproject.com/wiki/JSON1Extension)
* redis (in production, not needed for development)

### Installation
Expand Down
3 changes: 2 additions & 1 deletion apps/cms/contacts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from wagtail.admin.panels import MultiFieldPanel
from wagtail.admin.panels import ObjectList
from wagtail.admin.panels import TabbedInterface
from wagtail.admin.panels import TitleFieldPanel
from wagtail.contrib.forms.forms import FormBuilder
from wagtail.contrib.forms.models import AbstractEmailForm
from wagtail.contrib.forms.models import AbstractFormField
Expand Down Expand Up @@ -195,7 +196,7 @@ def get_form_fields(self):
]

common_panels = [
FieldPanel("title"),
TitleFieldPanel("title"),
FieldPanel("slug"),
MultiFieldPanel(
[
Expand Down
32 changes: 32 additions & 0 deletions apps/cms/images/migrations/0003_auto_20240208_1216.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 3.2.19 on 2024-02-08 11:16

from django.db import migrations
import wagtail.images.models


class Migration(migrations.Migration):
dependencies = [
("a4_candy_cms_images", "0002_alter_customimage_file_hash"),
]

operations = [
migrations.AlterField(
model_name="customimage",
name="file",
field=wagtail.images.models.WagtailImageField(
height_field="height",
upload_to=wagtail.images.models.get_upload_to,
verbose_name="file",
width_field="width",
),
),
migrations.AlterField(
model_name="customrendition",
name="file",
field=wagtail.images.models.WagtailImageField(
height_field="height",
upload_to=wagtail.images.models.get_rendition_upload_to,
width_field="width",
),
),
]
5 changes: 3 additions & 2 deletions apps/cms/news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from wagtail.admin.panels import FieldPanel
from wagtail.admin.panels import ObjectList
from wagtail.admin.panels import TabbedInterface
from wagtail.admin.panels import TitleFieldPanel
from wagtail.models import Page

from apps.contrib.translations import TranslatedField
Expand Down Expand Up @@ -46,7 +47,7 @@ def get_context(self, request):
FieldPanel("subtitle_en"),
]

common_panels = [FieldPanel("title"), FieldPanel("slug")]
common_panels = [TitleFieldPanel("title"), FieldPanel("slug")]

edit_handler = TabbedInterface(
[
Expand Down Expand Up @@ -116,7 +117,7 @@ class NewsPage(Page):
]

common_panels = [
FieldPanel("title"),
TitleFieldPanel("title"),
FieldPanel("image"),
FieldPanel("author"),
FieldPanel("slug"),
Expand Down
6 changes: 3 additions & 3 deletions apps/cms/pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from wagtail.admin.panels import ObjectList
from wagtail.admin.panels import PageChooserPanel
from wagtail.admin.panels import TabbedInterface
from wagtail.admin.panels import TitleFieldPanel
from wagtail.images.blocks import ImageChooserBlock
from wagtail.models import Page

Expand All @@ -20,7 +21,6 @@


class HomePage(Page):

image_1 = models.ForeignKey(
"a4_candy_cms_images.CustomImage",
null=True,
Expand Down Expand Up @@ -157,7 +157,7 @@ def random_image(self):
]

common_panels = [
FieldPanel("title"),
TitleFieldPanel("title"),
FieldPanel("slug"),
PageChooserPanel("form_page", "a4_candy_cms_contacts.FormPage"),
MultiFieldPanel(
Expand Down Expand Up @@ -293,7 +293,7 @@ class SimplePage(Page):

ru_content_panels = [FieldPanel("body_streamfield_ru")]

common_panels = [FieldPanel("title"), FieldPanel("slug")]
common_panels = [TitleFieldPanel("title"), FieldPanel("slug")]

edit_handler = TabbedInterface(
[
Expand Down
8 changes: 4 additions & 4 deletions apps/cms/settings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
from wagtail import fields
from wagtail.admin.panels import FieldPanel
from wagtail.admin.panels import PageChooserPanel
from wagtail.contrib.settings.models import BaseSetting
from wagtail.contrib.settings.models import BaseSiteSetting
from wagtail.contrib.settings.models import register_setting

from apps.contrib.translations import TranslatedField


@register_setting(icon="warning")
class ImportantPages(BaseSetting):
class ImportantPages(BaseSiteSetting):
terms_of_use = models.ForeignKey(
"wagtailcore.Page",
related_name="important_page_terms_of_use",
Expand Down Expand Up @@ -115,7 +115,7 @@ class ImportantPages(BaseSetting):

# these are settings for platform organisation
@register_setting(icon="pick")
class OrganisationSettings(BaseSetting):
class OrganisationSettings(BaseSiteSetting):
platform_name = models.CharField(
max_length=20,
default="adhocracy+",
Expand Down Expand Up @@ -143,7 +143,7 @@ class Meta:


@register_setting
class SocialMedia(BaseSetting):
class SocialMedia(BaseSiteSetting):
facebook = models.URLField(blank=True)
twitter = models.URLField(blank=True)
github = models.URLField(blank=True)
Expand Down
6 changes: 3 additions & 3 deletions apps/cms/use_cases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from wagtail.admin.panels import ObjectList
from wagtail.admin.panels import PageChooserPanel
from wagtail.admin.panels import TabbedInterface
from wagtail.admin.panels import TitleFieldPanel
from wagtail.models import Page

from apps.contrib.translations import TranslatedField
Expand Down Expand Up @@ -82,7 +83,7 @@ def get_context(self, request):
]

common_panels = [
FieldPanel("title"),
TitleFieldPanel("title"),
FieldPanel("slug"),
FieldPanel("demo_link"),
PageChooserPanel("form_page", "a4_candy_cms_contacts.FormPage"),
Expand All @@ -100,7 +101,6 @@ def get_context(self, request):


class UseCasePage(Page):

category = models.CharField(max_length=2, choices=CATEGORY_CHOICES)

image = models.ForeignKey(
Expand Down Expand Up @@ -165,7 +165,7 @@ def get_context(self, request):
de_content_panels = [FieldPanel("title_de"), FieldPanel("body_streamfield_de")]

common_panels = [
FieldPanel("title"),
TitleFieldPanel("title"),
FieldPanel("image"),
FieldPanel("slug"),
FieldPanel("category"),
Expand Down
2 changes: 1 addition & 1 deletion apps/notifications/emails.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import auth
from django.urls import reverse
from wagtail.core.models import Site
from wagtail.models import Site

from apps.cms.settings.models import ImportantPages
from apps.organisations.models import Organisation
Expand Down
15 changes: 15 additions & 0 deletions changelog/7637_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Upgraded

- wagtail from 4.1.9 to 4.2
- replace BaseSettings with BaseSiteSettings
- import Site from wagtail.models instead of wagtail.core.models
- migration for WagtailImageField which extends Django’s ImageField to use Willow for image file handling

- wagtail from 4.2 to 5.0x
- New field for choosing css themes
wagtail/users/migrations/0012_userprofile_theme.py
- Migrate FieldPanel to TitleFieldPanel for slug field sync functionality

- wagtail from 5.0 to 5.1.x
- wagtail: upgrade to 5.2.x
- django-filters: upgrade to 23.5 as required by wagtail 5.2
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ django-cloudflare-push==0.2.2
django_csp==3.7
django-parler==2.3
sentry-sdk==1.25.1
wagtail==4.1.6
wagtail==5.2.3
whitenoise==6.4.0
xmltodict==0.13.0
zeep==4.2.1
Expand All @@ -19,7 +19,7 @@ Django==3.2.19
django-allauth==0.54.0
git+https://github.com/liqd/django-autoslug.git@liqd2212#egg=django-autoslug
django-ckeditor==6.5.1
django-filter==22.1
django-filter==23.5
django-widget-tweaks==1.4.12
djangorestframework==3.14.0
easy-thumbnails[svg]==2.8.5
Expand Down
Loading