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

Upgrade to wagtail 5.2 #34

Merged
merged 4 commits into from
Jul 12, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ jobs:
test-sqlite:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.9", "3.10", "3.11", "3.12"]
database: ["sqlite"]

steps:
Expand Down Expand Up @@ -45,9 +44,8 @@ jobs:
test-postgres:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.12"]
database: ["postgres"]

services:
Expand Down Expand Up @@ -93,9 +91,8 @@ jobs:
test-mysql:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.12"]
database: ["mysql"]

services:
Expand Down
18 changes: 0 additions & 18 deletions .gitpod.yml

This file was deleted.

15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.1
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.1.0
hooks:
- id: flake8
- repo: https://github.com/jackdewinter/pymarkdown
Expand All @@ -19,3 +19,12 @@ repos:
- --disable-rules
- line-length
- scan
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.19.0" # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, "5.0"] # Replace with Django version
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.

## Unreleased

- Upgrade for Wagtail 5.2+ & Django 4.2+
- Update pr-commit config
- Fix typo in docs

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ run:
python manage.py runserver 0:8000

mail:
cp tests/local.py.example tests/local.py
docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog

test:
Expand Down
7 changes: 2 additions & 5 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ With a virtual environment activated, install the package in editable mode:
pip install -e ".[development]"
```

There is a [testapp](../tests/testapp/) provided that is a fully configured minimal setup using Wagtail v4.2
There is a [testapp](../tests/testapp/) provided that is a fully configured minimal setup using Wagtail v5.1+

Setup the app:

Expand All @@ -32,8 +32,6 @@ make run

View the site at `http://localhost:8000` or add `/admin` to login.

> You can see if emails are sent or not via the console.

### A convenient SMTP server

If you have docker and docker-compose installed
Expand All @@ -42,8 +40,7 @@ If you have docker and docker-compose installed
make mail
```

> Will spin up a Mailhog instance and simulate a `real` email inbox.
and will add a local.py file to settings in the test app settings with the correct EMAIL_BACKEND and credentials
> Will spin up a Mailhog instance and simulate a `real` email inbox.
View the Mailhog app in your browser at `http://localhost:8025`

Now when you submit the form with settings to send the notification email you will see the email in the Mailhog inbox
Expand Down
17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Wagtail",
"Framework :: Wagtail :: 4",
"Framework :: Wagtail :: 5",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies =[
"Wagtail>=4.1",
"Wagtail>=5.1,<6.0",
]

[project.optional-dependencies]
development = [
"black==23.7.0",
"flake8==6.1.0",
"isort==5.12.0",
"black==24.4.2",
"flake8==7.1.0",
"isort==5.13.2",
"django-upgrade",
"pyupgrade",
]
13 changes: 0 additions & 13 deletions tests/local.py.example

This file was deleted.

26 changes: 15 additions & 11 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@
SECRET_KEY = "secret"
DEBUG = True
ALLOWED_HOSTS = ["*"]
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

# Package test settings
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "127.0.0.1"
EMAIL_PORT = 1025
EMAIL_HOST_USER = ""
EMAIL_HOST_PASSWORD = ""
EMAIL_USE_TLS = False

DEFAULT_FROM_EMAIL = "foo@localhost"

# honeypot default settings
HONEYPOT_NAME_FIELD = "whf_name"
HONEYPOT_TIME_FIELD = "whf_time"
HONEYPOT_TIME_INTERVAL = 3 # minimum time taken to fill out the form in seconds

INSTALLED_APPS = [
"wagtail_honeypot",
Expand All @@ -27,17 +41,12 @@
"wagtail.contrib.search_promotions",
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.embeds",
"wagtail.users",
"wagtail.snippets",
"wagtail.documents",
"wagtail.images",
"wagtail.search",
"wagtail.admin",
"wagtail.api.v2",
"wagtail.contrib.modeladmin",
"wagtail.contrib.routable_page",
"wagtail.contrib.styleguide",
"wagtail.sites",
"wagtail",
"taggit",
Expand Down Expand Up @@ -147,8 +156,3 @@
from .local import * # noqa
except ImportError:
pass

try:
from .gitpod_settings import * # noqa
except ImportError:
pass
1 change: 0 additions & 1 deletion tests/testapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion tests/testapp/migrations/0002_create_homepage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import migrations


Expand Down
11 changes: 5 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ usedevelop = True
isolated_build = True

envlist =
py{38,39,310}-django{32,41}-wagtail{41,51,52}-{sqlite,postgres,mysql}
py{311}-django{42}-wagtail{52}-{sqlite,postgres,mysql}
py{39}-django{42}-wagtail{51,52}-sqlite
py{310,311,312}-django{50}-wagtail{52}-sqlite
py{312}-django{50}-wagtail{52}-{postgres,mysql}

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DATABASE =
Expand All @@ -29,11 +30,9 @@ commands =
deps =
coverage

django32: Django>=3.2,<4.0
django41: Django>=4.1,<4.2
django42: Django>=4.2,<5.0
django50: Django>=5.0,<5.1

wagtail41: wagtail>=4.1,<4.2
wagtail51: wagtail>=5.1,<5.2
wagtail52: wagtail>=5.2,<5.3

Expand Down
Loading