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

Wagtail upgrade #362

Merged
merged 7 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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: 0 additions & 1 deletion apps/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from . import monkey_patches # noqa
5 changes: 5 additions & 0 deletions apps/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
class CoreConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.core"

def ready(self):
from .monkey_patches import patch_copy_for_translation_action

patch_copy_for_translation_action()
4 changes: 2 additions & 2 deletions apps/core/blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.utils.translation import gettext as _
from wagtail.core import blocks
from wagtail.core.blocks import RichTextBlock
from wagtail import blocks
from wagtail.blocks import RichTextBlock


class TextBlock(RichTextBlock):
Expand Down
2 changes: 1 addition & 1 deletion apps/core/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.conf import settings
from django.utils import timezone
from faker import Faker
from wagtail.core.models import Locale, Page, Site
from wagtail.models import Locale, Page, Site

from apps.core.models import ContentPage, HomePage

Expand Down
2 changes: 1 addition & 1 deletion apps/core/management/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.db.migrations.operations import AlterModelOptions
from django.db.models import Field, FileField
from django.db.models.fields.related import RelatedField
from wagtail.core.fields import StreamField
from wagtail.fields import StreamField

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion apps/core/models/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.template import Context, Template
from django.utils.text import slugify
from wagtail.admin.panels import FieldPanel
from wagtail.core.fields import StreamField
from wagtail.fields import StreamField
from wagtail.models import Page

from apps.core.models.feedback import Feedback
Expand Down
2 changes: 1 addition & 1 deletion apps/core/models/home.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models
from wagtail.admin.panels import FieldPanel
from wagtail.core.fields import StreamField
from wagtail.fields import StreamField
from wagtail.models import Page

from ..blocks import HOME_BLOCKS
Expand Down
9 changes: 6 additions & 3 deletions apps/monkey_patches.py → apps/core/monkey_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

logger = logging.getLogger(__name__)

logger.warning("Monkey patching `CopyPageForTranslationAction._copy_for_translation`")


# flake8: noqa: C901
@transaction.atomic
Expand Down Expand Up @@ -82,4 +80,9 @@ def process_child_object(
)


CopyPageForTranslationAction._copy_for_translation = _copy_for_translation
def patch_copy_for_translation_action():
logger.warning(
"Monkey patching `CopyPageForTranslationAction._copy_for_translation`"
)

CopyPageForTranslationAction._copy_for_translation = _copy_for_translation
2 changes: 1 addition & 1 deletion apps/core/templatetags/core_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import template
from django.utils.translation import get_language
from wagtail.core.models import Page
from wagtail.models import Page

from apps.core.models import FooterContent, HomePage

Expand Down
2 changes: 1 addition & 1 deletion apps/core/tests/test_header.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.template import Context, Template
from django.test import TestCase
from django.utils import translation
from wagtail.core.models import Page
from wagtail.models import Page

from apps.core.factories import HomePageFactory

Expand Down
2 changes: 1 addition & 1 deletion apps/core/tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.core.management import call_command
from django.test import TestCase
from wagtail.core.models import Page
from wagtail.models import Page


class TestBuildFixtures(TestCase):
Expand Down
33 changes: 33 additions & 0 deletions apps/custom_media/migrations/0003_wagtail_42.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.1.2 on 2023-10-30 14:44

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


class Migration(migrations.Migration):

dependencies = [
("custom_media", "0002_initial"),
]

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",
),
),
]
1 change: 1 addition & 0 deletions apps/guide/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.modeladmin",
"wagtail.contrib.search_promotions",
"wagtail.embeds",
"wagtail.sites",
"wagtail.users",
Expand Down
2 changes: 1 addition & 1 deletion apps/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from rest_framework import serializers
from rest_framework.decorators import api_view
from rest_framework.response import Response
from wagtail.contrib.search_promotions.models import Query
from wagtail.models import Locale, Page
from wagtail.search.models import Query


def search(request):
Expand Down
1,456 changes: 675 additions & 781 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.9"
django = ">=4.1,<4.2"
wagtail = ">=4.0,<4.1"
wagtail = ">=5.0,<5.1"
django-manifest-loader = "^1.0.0"
lxml = ">=4.9,<5"
djangorestframework = ">=3.13.1,<4.0"
dj-database-url = "1.0.0"
django-storages = "1.13.1"
whitenoise = "6.2.0"
psycopg2 = "2.9.3"
wagtail-localize = "^1.3.1"
wagtail-localize = "^1.6"

[tool.poetry.group.dev.dependencies]
black = "^22.10.0"
Expand Down