Skip to content

Commit 4322f07

Browse files
committed
Merge branch 'release/2.0.0'
2 parents dec3a24 + 52b7fa9 commit 4322f07

File tree

14 files changed

+79
-41
lines changed

14 files changed

+79
-41
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,38 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
10+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1111
wagtail-version:
1212
- 4.1.3
13-
- 4.2.1
14-
- 5.0
13+
- 5.1
14+
- 5.2
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
2424
python -m pip install .[testing]
25+
python -m pip install wagtail-modeladmin
2526
pip install -q wagtail==${{ matrix.wagtail-version }}
2627
- name: Run tests
2728
run: |
2829
python runtests.py
30+
- name: Run tests with wagtail-modeladmin
31+
run: |
32+
python runtests.py
33+
env:
34+
DJANGO_SETTINGS_MODULE: tests.app.settings_with_wagtail_modeladmin
35+
2936

3037
lint-black:
3138
runs-on: ubuntu-latest
3239
needs: test
3340
steps:
34-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@v4
3542
- uses: psf/black@stable
3643
with:
3744
options: "--check --verbose --exclude=migrations"
@@ -42,8 +49,8 @@ jobs:
4249
runs-on: ubuntu-latest
4350
needs: test
4451
steps:
45-
- uses: actions/checkout@v2
46-
- uses: actions/setup-python@v2
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
4754
with:
4855
python-version: 3.8
4956
- name: Install dependencies
@@ -56,8 +63,8 @@ jobs:
5663
runs-on: ubuntu-latest
5764
needs: [test, lint-black, lint-isort]
5865
steps:
59-
- uses: actions/checkout@v2
60-
- uses: actions/setup-python@v2
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-python@v5
6168
with:
6269
python-version: 3.8
6370
- name: Install dependencies

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
### Fixed
77
### Removed
88

9+
## [2.0.0] - 2023-12-30
10+
### Added
11+
- Add Python 3.12 support (@marteinn)
12+
- Add Wagtail 5.1 support (@marteinn)
13+
- Add Wagtail 5.2 support (@marteinn)
14+
- Add wagtail-modeladmin support (@marteinn)
15+
16+
### Fixed
17+
- Upgrade python version in example environment and resolve build issues
18+
- Replace deprecated assertEquals with assertEqual
19+
- Upgrade github actions (@marteinn)
20+
21+
### Removed
22+
- Drop EOL Python 3.7 support (@marteinn)
23+
- Drop EOL Wagtail 4.2 support (@marteinn)
24+
- Drop EOL Wagtail 5.0 support (@marteinn)
25+
926
## [1.0.1] - 2023-05-21
1027
### Added
1128
- Add Wagtail 5 support (@marteinn)

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim
1+
FROM python:3.12-slim
22

33
WORKDIR /srv
44

@@ -14,12 +14,12 @@ ENV PYTHONUNBUFFERED=1 \
1414
COPY . /srv/
1515

1616
RUN apt-get update \
17-
&& apt-get install -y netcat \
17+
&& apt-get install -y netcat-traditional \
1818
binutils libproj-dev \
1919
gettext libpq-dev build-essential \
2020
--no-install-recommends && rm -rf /var/lib/apt/lists/*
2121

22-
RUN pip install psycopg2-binary~=2.8.0 -e .
22+
RUN pip install psycopg2-binary -e .
2323

2424
ENTRYPOINT ["./docker-entrypoint.sh"]
2525
CMD ["runserver"]

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Instead of deleting pages when pressing delete, pages will get thrown into the "
77

88
## Install
99

10-
First install the python package:
10+
1. First install the python package:
1111
`pip install wagtail-trash`
1212

13-
Then add it to your `INSTALLED_APPS`:
13+
2. Then add it to your `INSTALLED_APPS`:
1414

1515
```python
1616
INSTALLED_APPS = [
@@ -20,7 +20,17 @@ INSTALLED_APPS = [
2020
]
2121
```
2222

23-
Run migrations, et voila!
23+
If you are using [wagtail-modeladmin](https://github.com/wagtail-nest/wagtail-modeladmin/) then use `"wagtail_modeladmin"` instead of `"wagtail.contrib.modeladmin"`. like this:
24+
25+
```python
26+
INSTALLED_APPS = [
27+
# ...
28+
"wagtail_modeladmin",
29+
"wagtail_trash",
30+
]
31+
```
32+
33+
3. Run migrations, et voila!
2434

2535

2636
## How it works

docker-compose.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
services:
1+
version: "3"
2+
services:
23
web:
34
build: "./"
4-
depends_on:
5+
depends_on:
56
- db
67
ports:
78
- "8080:8080"
@@ -11,6 +12,7 @@ services:
1112
- "./wagtail_trash:/srv/wagtail_trash"
1213
- "./settings_dev.py:/srv/settings_dev.py"
1314
- "./manage.py:/srv/manage.py"
15+
- "./runtests.py:/srv/runtests.py"
1416
working_dir: /srv
1517
environment:
1618
- DATABASE_HOST=db
@@ -23,4 +25,3 @@ services:
2325
- POSTGRES_PASSWORD=postgres
2426
- POSTGRES_DB=postgres
2527
- POSTGRES_HOST_AUTH_METHOD=trust
26-
version: "3"

runtests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
from django.core.management import execute_from_command_line
66

7-
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.app.settings"
7+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.app.settings")
8+
9+
print("Using settings: {}".format(os.environ["DJANGO_SETTINGS_MODULE"]))
810

911

1012
def runtests():

settings_dev.py

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

33
DATABASES = {
44
"default": {
5-
"ENGINE": "django.db.backends.postgresql_psycopg2",
5+
"ENGINE": "django.db.backends.postgresql",
66
"HOST": "db",
77
"NAME": "postgres",
88
"USER": "postgres",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
"Operating System :: OS Independent",
3737
"Programming Language :: Python",
3838
"Programming Language :: Python :: 3",
39-
"Programming Language :: Python :: 3.7",
4039
"Programming Language :: Python :: 3.8",
4140
"Programming Language :: Python :: 3.9",
4241
"Programming Language :: Python :: 3.10",
4342
"Programming Language :: Python :: 3.11",
43+
"Programming Language :: Python :: 3.12",
4444
"Framework :: Django",
4545
"Framework :: Django :: 3.2",
4646
"Framework :: Django :: 4.0",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from .settings import * # noqa
2+
3+
INSTALLED_APPS = [
4+
"wagtail_modeladmin" if x == "wagtail.contrib.modeladmin" else x
5+
for x in INSTALLED_APPS
6+
]

tests/test_admin.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_visiting_bin_creates_one_if_not_exists(self):
1919

2020
assert TrashCanPage.objects.count() == 0
2121

22-
resp = self.client.get(index_url)
22+
self.client.get(index_url)
2323

2424
assert TrashCanPage.objects.count() == 1
2525

@@ -165,9 +165,9 @@ def test_removing_two_pages_with_same_slug(self):
165165
cat_instance_2 = root_page.add_child(instance=cat_2)
166166

167167
delete = Page(title="delete", slug="delete")
168-
delete_instance = cat_instance.add_child(instance=delete)
168+
cat_instance.add_child(instance=delete)
169169
delete_2 = Page(title="delete", slug="delete")
170-
delete_instance_2 = cat_instance_2.add_child(instance=delete_2)
170+
cat_instance_2.add_child(instance=delete_2)
171171

172172
with self.register_hook("before_delete_page", trash_delete):
173173
delete_url = reverse("wagtailadmin_pages:delete", args=(delete.id,))
@@ -188,7 +188,6 @@ def test_removing_page_unpublishes_all_sub_pages(self):
188188

189189
sub_page = Page(title="1p 2p", has_unpublished_changes=False, live=True)
190190
top.add_child(instance=sub_page)
191-
sub_page_id = sub_page.id
192191

193192
sub_sub_page = Page(title="1p 2p 3u", has_unpublished_changes=True, live=False)
194193
sub_page.add_child(instance=sub_sub_page)
@@ -218,7 +217,6 @@ def test_restoring_page_re_publishes(self):
218217

219218
sub_page = Page(title="1p 2p", has_unpublished_changes=False, live=True)
220219
top.add_child(instance=sub_page)
221-
sub_page_id = sub_page.id
222220

223221
sub_sub_page = Page(title="1p 2p 3u", has_unpublished_changes=True, live=False)
224222
sub_page.add_child(instance=sub_sub_page)

0 commit comments

Comments
 (0)