Skip to content

Commit

Permalink
Merge pull request #385 from jorenham/master
Browse files Browse the repository at this point in the history
Wagtail 5 support
  • Loading branch information
DiogoMarques29 authored May 8, 2023
2 parents 2f22f85 + 5d5059c commit 8a93256
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 520 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
django-modeltranslation: ["0.17", "0.18"]
wagtail: ["4.0", "4.1"]
wagtail: ["4.0", "4.1", "5.0"]
database: ["sqlite", "postgres", "mysql"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1,049 changes: 539 additions & 510 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.8"
Django = ">= 3.2"
wagtail = "^4.0"
wagtail = ">=4.0,<=6.0"
django-modeltranslation = ">=0.17"

[tool.poetry.dev-dependencies]
Expand Down
3 changes: 1 addition & 2 deletions wagtail_modeltranslation/patch_wagtailadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from modeltranslation.utils import build_localized_fieldname, get_language
from wagtail.admin.panels import (FieldPanel, FieldRowPanel, InlinePanel,
MultiFieldPanel, ObjectList,
RichTextFieldPanel,
extract_panel_definitions_from_model_class)
from wagtail.contrib.routable_page.models import RoutablePageMixin
from wagtail.coreutils import WAGTAIL_APPEND_SLASH
Expand All @@ -33,7 +32,7 @@
TRANSLATE_SLUGS)
from wagtail_modeltranslation.utils import compare_class_tree_depth

SIMPLE_PANEL_CLASSES = [FieldPanel, RichTextFieldPanel] + CUSTOM_SIMPLE_PANELS
SIMPLE_PANEL_CLASSES = [FieldPanel] + CUSTOM_SIMPLE_PANELS
COMPOSED_PANEL_CLASSES = [MultiFieldPanel, FieldRowPanel] + CUSTOM_COMPOSED_PANELS
INLINE_PANEL_CLASSES = [InlinePanel] + CUSTOM_INLINE_PANELS

Expand Down
4 changes: 2 additions & 2 deletions wagtail_modeltranslation/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class StreamFieldPanelSnippet(models.Model):
('text', blocks.CharBlock(max_length=10))
],
blank=False,
use_json_field=False
use_json_field=True
)

panels = [
Expand Down Expand Up @@ -202,7 +202,7 @@ class StreamFieldPanelPage(Page):
('text', blocks.CharBlock(max_length=10))
],
blank=False,
use_json_field=False
use_json_field=True
)

content_panels = [
Expand Down
6 changes: 3 additions & 3 deletions wagtail_modeltranslation/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def check_fieldpanel_patching(self, panels, name='name'):
self.assertEquals(len(panels), 2)

# Validate if the created panels are instances of FieldPanel
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel

self.assertIsInstance(panels[0], FieldPanel)
self.assertIsInstance(panels[1], FieldPanel)
Expand All @@ -76,7 +76,7 @@ def check_fieldrowpanel_patching(self, panels, child_name='other_name'):
# Check if the fieldrowpanel still exists
self.assertEqual(len(panels), 1)

from wagtail.admin.edit_handlers import FieldRowPanel
from wagtail.admin.panels import FieldRowPanel
self.assertIsInstance(panels[0], FieldRowPanel)

# Check if the children were correctly patched using the fieldpanel test
Expand Down Expand Up @@ -120,7 +120,7 @@ def check_multipanel_patching(self, panels):
# children panels
self.assertEquals(len(panels), 3)

from wagtail.admin.edit_handlers import MultiFieldPanel
from wagtail.admin.panels import MultiFieldPanel
self.assertIsInstance(panels[0], MultiFieldPanel)
self.assertIsInstance(panels[1], MultiFieldPanel)
self.assertIsInstance(panels[2], MultiFieldPanel)
Expand Down

0 comments on commit 8a93256

Please sign in to comment.