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 4.2 support #79

Merged
merged 9 commits into from Mar 18, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]
experimental: [false]
toxenv: ["py"]
include:
Expand All @@ -26,13 +26,13 @@ jobs:
toxenv: isort
experimental: false
# Future Wagtail release from main branch (allowed to fail)
- python: "3.10"
- python: "3.11"
toxenv: wagtailmain
experimental: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased](https://github.com/wagtail/wagtail-bakery/compare/0.6.0...HEAD)

- Nothing new yet
### Added

- Compatibility with Python 3.11 and Wagtail 4.2. [#79](https://github.com/wagtail/wagtail-bakery/pull/79)

### Removed

- Drop support for Wagtail before 4.1 [#79](https://github.com/wagtail/wagtail-bakery/pull/79)

## [0.6.0](https://github.com/wagtail/wagtail-bakery/compare/0.5.0...0.6.0)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -24,9 +24,9 @@ Wagtail-bakery is built on top of [Django bakery](https://github.com/datadesk/dj

## Supported Versions

- Python 3.8 - 3.10
- Python 3.8 - 3.11
- Django 3.2 - 4.1
- Wagtail 2.15 - 4.1
- Wagtail >= 4.1

We aim to support the Wagtail versions as [supported](http://docs.wagtail.io/en/latest/releases/upgrading.html) by Wagtail (current LTS, current stable).

Expand Down
11 changes: 5 additions & 6 deletions examples/aws/example/migrations/0001_initial.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-22 14:31
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations, models
from wagtail import blocks, fields


class Migration(migrations.Migration):
Expand All @@ -19,7 +18,7 @@ class Migration(migrations.Migration):
name='BlogListPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -30,7 +29,7 @@ class Migration(migrations.Migration):
name='BlogPostPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -41,7 +40,7 @@ class Migration(migrations.Migration):
name='GenericPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -52,7 +51,7 @@ class Migration(migrations.Migration):
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand Down
10 changes: 5 additions & 5 deletions examples/aws/example/models.py
@@ -1,7 +1,7 @@
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail import blocks
from wagtail.admin.panels import FieldPanel
from wagtail.fields import StreamField
from wagtail.models import Page

from wagtailbakery.models import AutoPublishingWagtailBakeryModel

Expand All @@ -13,7 +13,7 @@ class AbstractExamplePage(Page, AutoPublishingWagtailBakeryModel):

content_panels = [
FieldPanel('title'),
StreamFieldPanel('body')
FieldPanel('body')
]

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion examples/aws/example/settings.py
Expand Up @@ -52,7 +52,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',

'wagtail.contrib.settings',

Expand Down
2 changes: 1 addition & 1 deletion examples/aws/example/urls.py
Expand Up @@ -18,8 +18,8 @@
from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

urlpatterns = [
Expand Down
11 changes: 5 additions & 6 deletions examples/multisite/example/migrations/0001_initial.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-22 14:31
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations, models
from wagtail import blocks, fields


class Migration(migrations.Migration):
Expand All @@ -19,7 +18,7 @@ class Migration(migrations.Migration):
name='BlogListPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -30,7 +29,7 @@ class Migration(migrations.Migration):
name='BlogPostPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -41,7 +40,7 @@ class Migration(migrations.Migration):
name='GenericPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand All @@ -52,7 +51,7 @@ class Migration(migrations.Migration):
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', fields.StreamField([(b'paragraph', blocks.RichTextBlock())], use_json_field=True)),
],
options={
'abstract': False,
Expand Down
10 changes: 5 additions & 5 deletions examples/multisite/example/models.py
@@ -1,7 +1,7 @@
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail import blocks
from wagtail.admin.panels import FieldPanel
from wagtail.fields import StreamField
from wagtail.models import Page


class AbstractExamplePage(Page):
Expand All @@ -11,7 +11,7 @@ class AbstractExamplePage(Page):

content_panels = [
FieldPanel('title'),
StreamFieldPanel('body')
FieldPanel('body')
]

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion examples/multisite/example/settings.py
Expand Up @@ -48,7 +48,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',

'wagtail.contrib.settings',

Expand Down
2 changes: 1 addition & 1 deletion examples/multisite/example/urls.py
Expand Up @@ -18,8 +18,8 @@
from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

urlpatterns = [
Expand Down
12 changes: 6 additions & 6 deletions examples/site/example/migrations/0001_initial.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-22 14:31
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
from django.db import migrations, models


Expand All @@ -19,7 +19,7 @@ class Migration(migrations.Migration):
name='BlogListPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', wagtail.fields.StreamField([(b'paragraph', wagtail.blocks.RichTextBlock())])),
],
options={
'abstract': False,
Expand All @@ -30,7 +30,7 @@ class Migration(migrations.Migration):
name='BlogPostPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', wagtail.fields.StreamField([(b'paragraph', wagtail.blocks.RichTextBlock())])),
],
options={
'abstract': False,
Expand All @@ -41,7 +41,7 @@ class Migration(migrations.Migration):
name='GenericPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', wagtail.fields.StreamField([(b'paragraph', wagtail.blocks.RichTextBlock())])),
],
options={
'abstract': False,
Expand All @@ -52,7 +52,7 @@ class Migration(migrations.Migration):
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([(b'paragraph', wagtail.core.blocks.RichTextBlock())])),
('body', wagtail.fields.StreamField([(b'paragraph', wagtail.blocks.RichTextBlock())])),
],
options={
'abstract': False,
Expand Down
8 changes: 4 additions & 4 deletions examples/site/example/models.py
@@ -1,7 +1,7 @@
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail import blocks
from wagtail.admin.panels import FieldPanel, StreamFieldPanel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

from wagtail.fields import StreamField
from wagtail.models import Page


class AbstractExamplePage(Page):
Expand Down
2 changes: 1 addition & 1 deletion examples/site/example/settings.py
Expand Up @@ -48,7 +48,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',

'wagtail.contrib.settings',

Expand Down
2 changes: 1 addition & 1 deletion examples/site/example/urls.py
Expand Up @@ -18,8 +18,8 @@
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

urlpatterns = [
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -5,7 +5,7 @@

install_requires = [
'django-bakery~=0.13.1',
'wagtail>=2.15',
'wagtail>=4.1',
]

test_requires = [
Expand Down Expand Up @@ -44,12 +44,12 @@
'License :: OSI Approved :: MIT License',
'Framework :: Django',
'Framework :: Wagtail',
'Framework :: Wagtail :: 2',
'Framework :: Wagtail :: 4',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
)
2 changes: 1 addition & 1 deletion src/wagtailbakery/api_views.py
Expand Up @@ -7,7 +7,7 @@
from django.contrib.contenttypes.models import ContentType
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.api.v2.views import PagesAPIViewSet
from wagtail.core.models import Page, Site
from wagtail.models import Page, Site

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/wagtailbakery/signal_handlers.py
@@ -1,4 +1,4 @@
from wagtail.core.signals import page_published, page_unpublished
from wagtail.signals import page_published, page_unpublished


def handle_publish(sender, instance, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/wagtailbakery/views.py
Expand Up @@ -8,7 +8,7 @@
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.test.client import RequestFactory
from wagtail.core.models import Page, Site
from wagtail.models import Page, Site

logger = logging.getLogger(__name__)

Expand Down
16 changes: 5 additions & 11 deletions tests/conftest.py
@@ -1,7 +1,6 @@
import os

from django.conf import settings
from wagtail import VERSION as WAGTAIL_VERSION

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand All @@ -20,17 +19,12 @@ def pytest_configure():
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',
]

wagtail_middleware = [
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]
if WAGTAIL_VERSION >= (2, 9):
wagtail_middleware = [
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]
else:
wagtail_middleware = [
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
]
Comment on lines -25 to -33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that is old compatibility code. Thanks for cleaning that up! 🚀


settings.configure(
SECRET_KEY="secret_for_testing_only",
Expand Down
2 changes: 1 addition & 1 deletion tests/factories/page.py
@@ -1,5 +1,5 @@
import factory
from wagtail.core.models import Page
from wagtail.models import Page


class PageFactory(factory.DjangoModelFactory):
Expand Down
2 changes: 1 addition & 1 deletion tests/factories/site.py
@@ -1,5 +1,5 @@
import factory
from wagtail.core.models import Site
from wagtail.models import Site


class SiteFactory(factory.DjangoModelFactory):
Expand Down