Skip to content

Commit

Permalink
Merge pull request #176 from springload/chore/wagtail-update-30
Browse files Browse the repository at this point in the history
Upgrade wagtail to 3.0
  • Loading branch information
AndrewCalderSpringload authored Oct 30, 2023
2 parents adbdf2f + 3a9f69e commit 27bde45
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 44 deletions.
11 changes: 11 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Lists available recipes
default:
@just --list

# Run manage.py migrate
migrate:
docker-compose exec -T application sh -c 'python manage.py migrate'

# Shell (backend)
shell:
docker-compose exec application sh
2 changes: 1 addition & 1 deletion core/management/commands/create_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.core.management import BaseCommand

from wagtail.contrib.redirects.models import Redirect
from wagtail.core.models import Page
from wagtail.models import Page


class Command(BaseCommand):
Expand Down
8 changes: 4 additions & 4 deletions core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import django.db.models.deletion
from django.db import migrations, models

import wagtail.core.fields
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -33,7 +33,7 @@ class Migration(migrations.Migration):
to="wagtailcore.Page",
),
),
("body", wagtail.core.fields.RichTextField(null=True, blank=True)),
("body", wagtail.fields.RichTextField(null=True, blank=True)),
],
options={
"verbose_name": "Companies Index Page",
Expand All @@ -54,7 +54,7 @@ class Migration(migrations.Migration):
to="wagtailcore.Page",
),
),
("body", wagtail.core.fields.RichTextField(blank=True)),
("body", wagtail.fields.RichTextField(blank=True)),
(
"feed_image",
models.ForeignKey(
Expand Down Expand Up @@ -322,7 +322,7 @@ class Migration(migrations.Migration):
to="wagtailcore.Page",
),
),
("body", wagtail.core.fields.RichTextField(blank=True)),
("body", wagtail.fields.RichTextField(blank=True)),
],
options={
"abstract": False,
Expand Down
6 changes: 3 additions & 3 deletions core/migrations/0002_auto_20150419_2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.db import migrations, models

import wagtail.core.fields
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -16,7 +16,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="submitformpage",
name="body",
field=wagtail.core.fields.RichTextField(
field=wagtail.fields.RichTextField(
help_text=b"Edit the content you want to see before the form.",
blank=True,
),
Expand All @@ -37,7 +37,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="submitformpage",
name="thank_you_text",
field=wagtail.core.fields.RichTextField(
field=wagtail.fields.RichTextField(
help_text=b"Set the message users will see after submitting the form.",
blank=True,
),
Expand Down
6 changes: 3 additions & 3 deletions core/migrations/0007_auto_20170503_2308.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import django.db.models.deletion
from django.db import migrations, models

import wagtail.core.fields
import wagtail.fields


class Migration(migrations.Migration):
Expand Down Expand Up @@ -120,15 +120,15 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="submitformpage",
name="body",
field=wagtail.core.fields.RichTextField(
field=wagtail.fields.RichTextField(
blank=True,
help_text="Edit the content you want to see before the form.",
),
),
migrations.AlterField(
model_name="submitformpage",
name="thank_you_text",
field=wagtail.core.fields.RichTextField(
field=wagtail.fields.RichTextField(
blank=True,
help_text="Set the message users will see after submitting the form.",
),
Expand Down
51 changes: 51 additions & 0 deletions core/migrations/0016_auto_20231030_1543.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Django 3.2.13 on 2023-10-30 02:43

from django.db import migrations, models

import wagtail.contrib.forms.models


class Migration(migrations.Migration):

dependencies = [
("core", "0015_alter_wagtailcompanypage_coords"),
]

operations = [
migrations.AlterField(
model_name="submitformfield",
name="choices",
field=models.TextField(
blank=True,
help_text="Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.",
verbose_name="choices",
),
),
migrations.AlterField(
model_name="submitformfield",
name="default_value",
field=models.TextField(
blank=True,
help_text="Default value. Comma or new line separated values supported for checkboxes.",
verbose_name="default value",
),
),
migrations.AlterField(
model_name="submitformpage",
name="from_address",
field=models.EmailField(
blank=True, max_length=255, verbose_name="from address"
),
),
migrations.AlterField(
model_name="submitformpage",
name="to_address",
field=models.CharField(
blank=True,
help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.",
max_length=255,
validators=[wagtail.contrib.forms.models.validate_to_address],
verbose_name="to address",
),
),
]
4 changes: 2 additions & 2 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from django.utils.html import mark_safe

from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
from wagtail.core.fields import RichTextField
from wagtail.core.models import Page
from wagtail.fields import RichTextField
from wagtail.models import Page
from wagtail.search import index

from core import panels
Expand Down
11 changes: 5 additions & 6 deletions core/panels.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from wagtailgmaps.edit_handlers import MapFieldPanel

from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.core.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.models import Page

HOME_PAGE_CONTENT_PANELS = [
FieldPanel("title", classname="full title"),
Expand All @@ -15,7 +14,7 @@

WAGTAIL_PAGE_PROMOTE_PANELS = [
MultiFieldPanel(Page.promote_panels, "SEO and metadata fields"),
ImageChooserPanel("feed_image"),
FieldPanel("feed_image"),
]

WAGTAIL_SITE_PAGE_PROMOTE_PANELS = [
Expand All @@ -26,7 +25,7 @@
WAGTAIL_SITE_PAGE_CONTENT_PANELS = [
FieldPanel("title", classname="full title"),
FieldPanel("site_url"),
ImageChooserPanel("site_screenshot"),
FieldPanel("site_screenshot"),
FieldPanel("body", classname="full"),
FieldPanel("tags"),
FieldPanel("in_cooperation_with"),
Expand All @@ -37,7 +36,7 @@
FieldPanel("company_url"),
FieldPanel("github_url"),
FieldPanel("twitter_url"),
ImageChooserPanel("logo"),
FieldPanel("logo"),
FieldPanel("tags"),
MultiFieldPanel(
[
Expand Down
6 changes: 3 additions & 3 deletions core/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from django.dispatch import receiver
from django.utils.encoding import force_text

from wagtail.core.models import PageRevision
from wagtail.core.signals import page_published
from wagtail.models import PageRevision
from wagtail.signals import page_published

from core.models import WagtailPage, WagtailSitePage
from core.utilities import replace_tags
Expand Down Expand Up @@ -100,7 +100,7 @@ def pre_page_revision_save(sender, instance, **kwargs):
# Replace content field
setattr(mirror_page, field.name, clean_field)
# To json again
instance.content_json = mirror_page.to_json()
instance.content = mirror_page.to_json()


@receiver(post_save)
Expand Down
14 changes: 4 additions & 10 deletions core/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@

from django.db import models

from wagtail.admin.edit_handlers import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
)
from wagtail.core.models import Orderable
from wagtail.documents.edit_handlers import DocumentChooserPanel
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.models import Orderable
from wagtail.snippets.models import register_snippet


Expand Down Expand Up @@ -72,9 +66,9 @@ def link(self):
panels = [
MultiFieldPanel(
[
PageChooserPanel("link_page"),
FieldPanel("link_page"),
FieldPanel("link_external"),
DocumentChooserPanel("link_document"),
FieldPanel("link_document"),
FieldPanel("link_email"),
FieldPanel("link_phone"),
],
Expand Down
2 changes: 1 addition & 1 deletion core/templatetags/core_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django import template
from django.core.exceptions import ObjectDoesNotExist

from wagtail.core.models import Page
from wagtail.models import Page

from core.snippets import NavigationMenu

Expand Down
4 changes: 2 additions & 2 deletions core/tests/test_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# from wagtail.tests.utils import WagtailPageTests
# from wagtail.tests.utils.form_data import nested_form_data, streamfield, rich_text
# from wagtail.test.utils import WagtailPageTests
# from wagtail.test.utils.form_data import nested_form_data, streamfield, rich_text
# from core.models import *
#
# class HomePageTests(WagtailPageTests):
Expand Down
2 changes: 1 addition & 1 deletion core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.shortcuts import render

from wagtail.core.models import Page
from wagtail.models import Page
from wagtail.search.models import Query


Expand Down
2 changes: 1 addition & 1 deletion core/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf import settings
from django.utils.html import format_html_join

from wagtail.core import hooks
from wagtail import hooks


@hooks.register("insert_editor_css")
Expand Down
2 changes: 1 addition & 1 deletion madewithwagtail/settings/grains/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"rest_framework",
"wagtail.contrib.sitemaps",
"wagtail.contrib.routable_page",
"wagtail.core",
"wagtail",
"wagtail.admin",
"wagtail.documents",
"wagtail.snippets",
Expand Down
2 changes: 1 addition & 1 deletion madewithwagtail/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from django.urls import include, path, re_path
from django.views.generic import TemplateView

from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.images import urls as wagtailimages_urls
from wagtail.search.signal_handlers import (
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-c constraints.txt
Django>=3.2,<3.3
wagtail>=2.16,<2.17
wagtail~=3.0.3
boto3>=1.24.15,<1.25
psycopg2>=2.7

Expand Down
Loading

0 comments on commit 27bde45

Please sign in to comment.