Skip to content

Commit 5ca6e43

Browse files
authored
Merge pull request #5 from torchbox-forks/support/wagtail-52
Support/wagtail 52
2 parents 37040e6 + 424c530 commit 5ca6e43

19 files changed

+66
-140
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@ jobs:
88
strategy:
99
matrix:
1010
python-version:
11-
- "3.7"
1211
- "3.8"
1312
- "3.9"
1413
- "3.10"
1514
- "3.11"
1615
wagtail-version:
17-
- "2.15.6"
18-
- "4.1.2"
16+
- "4.1"
1917
- "4.2"
20-
exclude:
21-
- python-version: "3.11"
22-
wagtail-version: "2.15.6"
18+
- "5.0"
19+
- "5.1"
20+
- "5.2"
2321
steps:
24-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3
2523
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2725
with:
2826
python-version: ${{ matrix.python-version }}
2927
- name: Install dependencies
@@ -39,7 +37,7 @@ jobs:
3937
runs-on: ubuntu-latest
4038
needs: test
4139
steps:
42-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v3
4341
- uses: psf/black@stable
4442
with:
4543
options: "--check --verbose"
@@ -50,8 +48,8 @@ jobs:
5048
runs-on: ubuntu-latest
5149
needs: test
5250
steps:
53-
- uses: actions/checkout@v2
54-
- uses: actions/setup-python@v2
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-python@v4
5553
with:
5654
python-version: 3.8
5755
- name: Install dependencies
@@ -64,8 +62,8 @@ jobs:
6462
runs-on: ubuntu-latest
6563
needs: [test, lint-black, lint-isort]
6664
steps:
67-
- uses: actions/checkout@v2
68-
- uses: actions/setup-python@v2
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-python@v4
6967
with:
7068
python-version: 3.8
7169
- name: Install dependencies

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Added
9+
- Add Wagtail >= 5.0 support (@katdom13)
10+
- Add Python 4.2 support (@katdom13)
11+
- Add Python 3.11 support (@katdom13)
12+
913
### Changed
1014
### Fixed
1115
### Removed
16+
- Drop Wagtail < 4.1 support (@katdom13)
17+
- Drop Django 4.0 support (@katdom13)
18+
- Drop Python 3.7 support (@katdom13)
1219

1320
## [1.4.1] - 2023-02-19
1421
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Introduces panels for selecting colors in Wagtail.
1919
## Example
2020

2121
```python
22-
from wagtail.core.models import Page
22+
from wagtail.models import Page
2323

2424
from wagtail_color_panel.fields import ColorField
2525
from wagtail_color_panel.edit_handlers import NativeColorPanel

docs/1_getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
### Requirements
44

5-
- Python 3.7+
6-
- Wagtail 2.15+ and Django
5+
- Python 3.8+
6+
- Wagtail 4.1+ and Django 3.2+
77
- [A browser that supports `input type="color"`](https://caniuse.com/#feat=input-color)
88

99

docs/2_adding_to_a_page.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### First create a page
44

55
```python
6-
from wagtail.core.models import Page
6+
from wagtail.models import Page
77

88
class MyPage(Page):
99
...
@@ -15,7 +15,7 @@ class MyPage(Page):
1515
Define a ColorField that represents your color, in this example we call it `color`.
1616

1717
```python
18-
from wagtail.core.models import Page
18+
from wagtail.models import Page
1919
from wagtail_color_panel.fields import ColorField
2020

2121
class MyPage(Page):
@@ -28,7 +28,7 @@ Note: ColorField is built on top of CharField, so its also possible to use `Char
2828
### Add a content panel to represent the field in the admin
2929

3030
```python
31-
from wagtail.core.models import Page
31+
from wagtail.models import Page
3232
from wagtail_color_panel.edit_handlers import NativeColorPanel
3333

3434

@@ -46,7 +46,7 @@ We're done! After migration a color picker should appear.
4646
### Full example
4747

4848
```python
49-
from wagtail.core.models import Page
49+
from wagtail.models import Page
5050

5151
from wagtail_color_panel.fields import ColorField
5252
from wagtail_color_panel.edit_handlers import NativeColorPanel

docs/3_adding_to_a_streamfield.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
To add the color chooser to a StreamField, import and use the `NativeColorBlock`.
44

55
```python
6-
from wagtail.core.models import Page
7-
from wagtail.core.fields import StreamField
6+
from wagtail.models import Page
7+
from wagtail.fields import StreamField
88
from wagtail_color_panel.blocks import NativeColorBlock
99

1010

1111
class MyStreamFieldPage(Page):
1212
body = StreamField([
1313
('color', NativeColorBlock(default="#000000")),
14-
])
14+
], use_json_field=True)
1515

1616
content_panels = Page.content_panels + [
17-
StreamFieldPanel('body'),
17+
FieldPanel('body'),
1818
]
1919
```

docs/4_reference.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This panel uses the native `<input type="color"...` color selector (hence the na
99
#### How to use
1010

1111
```python
12-
from wagtail.core.models import Page
12+
from wagtail.models import Page
1313
from wagtail_color_panel.edit_handlers import NativeColorPanel
1414

1515
class MyPage(Page):
@@ -28,7 +28,7 @@ This panel uses the third party package [Spectrum](https://github.com/bgrins/spe
2828
#### How to use
2929

3030
```python
31-
from wagtail.core.models import Page
31+
from wagtail.models import Page
3232
from wagtail_color_panel.edit_handlers import PolyfillColorPanel
3333

3434
class MyPage(Page):
@@ -49,7 +49,7 @@ A field based on CharField that only accept color values saved as hex values (ex
4949
#### How to use
5050

5151
```python
52-
from wagtail.core.models import Page
52+
from wagtail.models import Page
5353
from wagtail_color_panel.fields import ColorField
5454

5555
class MyPage(Page):
@@ -66,17 +66,17 @@ This block uses the native `<input type="color"...` color selector (hence the na
6666
#### How to use
6767

6868
```python
69-
from wagtail.core.models import Page
70-
from wagtail.core.fields import StreamField
69+
from wagtail.models import Page
70+
from wagtail.fields import StreamField
7171
from wagtail_color_panel.blocks import NativeColorBlock
7272

7373

7474
class MyStreamFieldPage(Page):
7575
body = StreamField([
7676
('color', NativeColorBlock(default="#000000")),
77-
])
77+
], use_json_field=True)
7878

7979
content_panels = Page.content_panels + [
80-
StreamFieldPanel('body'),
80+
FieldPanel('body'),
8181
]
8282
```

setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from setuptools import find_packages, setup
66

7-
install_requires = ["wagtail>=2.15"]
7+
install_requires = ["wagtail>=4.1"]
88

99
tests_require = ["pytest-django", "wagtail-factories", "pytest"]
1010

@@ -40,21 +40,19 @@
4040
"Environment :: Web Environment",
4141
"Framework :: Django",
4242
"Framework :: Wagtail",
43-
"Framework :: Wagtail :: 2",
44-
"Framework :: Wagtail :: 3",
4543
"Framework :: Wagtail :: 4",
44+
"Framework :: Wagtail :: 5",
4645
"Intended Audience :: Developers",
4746
"License :: OSI Approved :: MIT License",
4847
"Operating System :: OS Independent",
4948
"Programming Language :: Python",
5049
"Programming Language :: Python :: 3",
51-
"Programming Language :: Python :: 3.7",
5250
"Programming Language :: Python :: 3.8",
5351
"Programming Language :: Python :: 3.9",
5452
"Programming Language :: Python :: 3.10",
5553
"Programming Language :: Python :: 3.11",
5654
"Topic :: Utilities",
5755
],
5856
setup_requires=["setuptools_scm", "pytest-runner"],
59-
python_requires=">=3.7",
57+
python_requires=">=3.8",
6058
)

tests/settings.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import os
22

3-
from wagtail import VERSION as WAGTAIL_VERSION
4-
53
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
64

75
ADMINS = (("[email protected]", "test"),)
@@ -26,7 +24,7 @@
2624
"wagtail.images",
2725
"wagtail.search",
2826
"wagtail.admin",
29-
"wagtail" if WAGTAIL_VERSION >= (3, 0) else "wagtail.core",
27+
"wagtail",
3028
"modelcluster",
3129
"taggit",
3230
"django.contrib.admin",

tests/test_block.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
from django.core.exceptions import ValidationError
22
from django.test import TestCase
3-
from wagtail import VERSION as WAGTAIL_VERSION
3+
from wagtail.test.utils import WagtailTestUtils
44

55
from wagtail_color_panel.blocks import NativeColorBlock
66
from wagtail_color_panel.widgets import ColorInputWidget
77

8-
if WAGTAIL_VERSION >= (3, 0):
9-
from wagtail.test.utils import WagtailTestUtils
10-
else:
11-
from wagtail.tests.utils import WagtailTestUtils
12-
138

149
class BlockTest(TestCase, WagtailTestUtils):
1510
def test_color_block_render(self):

0 commit comments

Comments
 (0)