Skip to content

Commit 100d90c

Browse files
authored
Add Wagtail 3.0 compatibility (#424)
* Changes to module paths * Update setup.py * Update contributors.md * Update tested versions with wagtail>=2.15 * Updated release notes
1 parent 8be2790 commit 100d90c

28 files changed

Lines changed: 130 additions & 56 deletions

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
python-version: ['3.7', '3.8', '3.9', '3.10']
1616
django-version: ['3.2', '4.0']
17-
wagtail-version: ['2.15', '2.16']
17+
wagtail-version: ['2.15', '2.16', '3.0']
1818
exclude:
1919
- python-version: '3.7'
2020
django-version: '4.0'

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
3.1.2 (17.06.2022)
5+
------------------
6+
7+
* Added support for Wagtail >3.0.
8+
* Updated travis/tox test settings to test against Wagtail 3.0.
9+
* Fix: [#421](https://github.com/jazzband/wagtailmenus/issues/421), which prevented creating or editing menus in wagtail 3.0.
10+
411
3.1.1 (25.04.2022)
512
------------------
613

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to
2727
* Sekani Tembo (Method Softworks)
2828
* Fernando Cordeiro (MrCordeiro)
2929
twitter.com/brauhaus
30+
* Abdulmajeed Isa (amajai)
3031

3132
## Translators
3233

docs/source/releases/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release notes
55
.. toctree::
66
:maxdepth: 1
77

8+
3.1.2
89
3.1.1
910
3.1
1011
3.0.2

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
'Framework :: Django :: 3.2',
7070
'Framework :: Django :: 4.0',
7171
'Framework :: Wagtail :: 2',
72+
'Framework :: Wagtail :: 3',
7273
'Topic :: Internet :: WWW/HTTP',
7374
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
7475
],

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ DJANGO =
1313
WAGTAIL =
1414
2.15: wt215
1515
2.16: wt216
16+
3.0: wt30
1617

1718
[tox]
1819
skipsdist = True
1920
usedevelop = True
2021

2122
envlist =
22-
py{37,38,39,310}-dj32-wt{215,216}
23-
py{38,39,310}-dj40-wt216
23+
py{37,38,39,310}-dj32-wt{215,216,30}
24+
py{38,39,310}-dj40-wt{216,30}
2425

2526
[testenv]
2627
description = Unit tests
@@ -38,3 +39,4 @@ deps =
3839
dj40: Django>=4.0,<4.1
3940
wt215: wagtail>=2.15,<2.16
4041
wt216: wagtail>=2.16,<2.17
42+
wt30: wagtail>=3.0,<3.1

wagtailmenus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# major.minor.patch.release.number
44
# release must be one of alpha, beta, rc, or final
5-
VERSION = (3, 1, 1, "final", 0)
5+
VERSION = (3, 1, 2, "final", 0)
66
__version__ = get_version(VERSION)
77
stable_branch_name = get_stable_branch_name(VERSION)
88

wagtailmenus/management/commands/autopopulate_main_menus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import logging
22

33
from django.core.management.base import BaseCommand
4-
from wagtail.core.models import Site
5-
64
from wagtailmenus.conf import settings
5+
try:
6+
from wagtail.models import Site
7+
except ImportError:
8+
from wagtail.core.models import Site
79

810
logger = logging.getLogger(__name__)
911

wagtailmenus/models/menuitems.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
from django.db import models
55
from django.utils.translation import gettext_lazy as _
66
from modelcluster.fields import ParentalKey
7-
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
8-
from wagtail.core.models import Page, Orderable
9-
107
from wagtailmenus.conf import settings
118
from wagtailmenus.managers import MenuItemManager
9+
try:
10+
from wagtail.admin.panels import FieldPanel, PageChooserPanel
11+
from wagtail.models import Page, Orderable
12+
except ImportError:
13+
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
14+
from wagtail.core.models import Page, Orderable
1215

1316

1417
#########################################################

wagtailmenus/models/menus.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
from django.utils.safestring import mark_safe
1111
from django.utils.translation import gettext_lazy as _
1212
from modelcluster.models import ClusterableModel
13-
from wagtail.core import hooks
14-
from wagtail.core.models import Page, Site
13+
try:
14+
from wagtail import hooks
15+
from wagtail.models import Page, Site
16+
except ImportError:
17+
from wagtail.core import hooks
18+
from wagtail.core.models import Page, Site
19+
1520

1621
from wagtailmenus import forms, panels
1722
from wagtailmenus.conf import constants, settings

0 commit comments

Comments
 (0)