Skip to content

Commit

Permalink
Merge pull request #71 from cfpb/support/wagtail-5.1-5.2
Browse files Browse the repository at this point in the history
Add support for Wagtail 5.1, 5.2, deprecate <=5.0
  • Loading branch information
chosak authored Dec 19, 2023
2 parents db88eda + 05f1a6a commit ff9f2fc
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 71 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ jobs:
matrix:
python: ['3.8', '3.11']
django: ['3.2', '4.2']
wagtail: ['4.1', '5.0']
exclude:
- django: '4.2'
wagtail: '4.1'
- python: '3.11'
django: '3.2'
wagtail: ['5.1', '5.2']

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.

## Unreleased

- Add support for Wagtail 5.1 and 5.2
- Drop support for Wagtail < 5.1 and dependence on wagtail.contrib.modeladmin

## 2.11 - 2023-11-29

- Add support for Wagtail 5.0 (https://github.com/cfpb/wagtail-sharing/pull/70)
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Add ``wagtailsharing`` as an installed app in your Django settings:
...
)
``wagtail.contrib.modeladmin`` is also required and must be included in your list of installed apps.
``wagtail.snippets`` is also required and must be included in your list of installed apps.

The code examples below assume that you are using a recent Wagtail version (3.0+).

Expand Down Expand Up @@ -203,7 +203,7 @@ This project has been tested for compatibility with:

* Python 3.9+
* Django 3.2+
* Wagtail 3.0 - 5.0
* Wagtail 5.1+ (see past releases for older Wagtail support)

It should be compatible with all intermediate versions, as well.
If you find that it is not, please `file an issue <https://github.com/cfpb/wagtail-sharing/issues/new>`_.
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ authors = [
{name = "CFPB", email = "[email protected]" }
]
dependencies = [
"wagtail>=3",
"wagtail>=5.1",
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Framework :: Wagtail",
"Framework :: Wagtail :: 3",
"Framework :: Wagtail :: 4",
"Framework :: Wagtail :: 5",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"License :: Public Domain",
Expand Down
12 changes: 4 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
skipsdist=True
envlist=
lint,
python{3.8}-django{3.2}-wagtail{3.0,4.1,5.0},
python{3.8,3.11}-django{4.2}-wagtail{5.0},
python{3.8,3.11}-django{3.2,4.2}-wagtail{5.1,5.2},
coverage

[testenv]
Expand All @@ -16,11 +15,8 @@ basepython=
python3.11: python3.11

deps=
django3.2: Django>=3.2,<3.3
django4.2: Django>=4.2,<4.3
wagtail3.0: wagtail>=3.0,<4.0
wagtail4.1: wagtail>=4.1,<4.2
wagtail5.0: wagtail>=5.0,<5.1
wagtail5.1: wagtail>=5.1,<5.2
wagtail5.2: wagtail>=5.2,<5.3

[testenv:lint]
basepython=python3.8
Expand Down Expand Up @@ -59,7 +55,7 @@ sections=FUTURE,STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
[testenv:interactive]
basepython=python3.8
deps=
wagtail>=5.0,<5.1
wagtail>=5.2,<5.3

commands_pre=
python {toxinidir}/testmanage.py makemigrations
Expand Down
2 changes: 0 additions & 2 deletions wagtailsharing/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

from . import checks # noqa F401


class WagtailSharingAppConfig(AppConfig):
name = "wagtailsharing"
Expand Down
23 changes: 0 additions & 23 deletions wagtailsharing/checks.py

This file was deleted.

2 changes: 1 addition & 1 deletion wagtailsharing/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

WAGTAIL_APPS = (
"wagtail.contrib.forms",
"wagtail.contrib.modeladmin",
"wagtail.contrib.routable_page",
"wagtail.contrib.settings",
"wagtail.test.routablepage",
Expand All @@ -36,6 +35,7 @@
"wagtail.documents",
"wagtail.images",
"wagtail.sites",
"wagtail.snippets",
"wagtail.users",
)

Expand Down
20 changes: 0 additions & 20 deletions wagtailsharing/tests/test_checks.py

This file was deleted.

2 changes: 1 addition & 1 deletion wagtailsharing/tests/test_wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_link_makes_button(self):
button = next(links)
self.assertEqual(button.url, url)
self.assertIn(
self.page.get_admin_display_title(), button.attrs["title"]
self.page.get_admin_display_title(), button.attrs["aria-label"]
)


Expand Down
11 changes: 6 additions & 5 deletions wagtailsharing/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@

from wagtail import hooks
from wagtail.admin import widgets as wagtailadmin_widgets
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from wagtail.snippets.models import register_snippet
from wagtail.snippets.views.snippets import SnippetViewSet

from wagtailsharing.helpers import get_sharing_url
from wagtailsharing.models import SharingSite


class SharingSiteModelAdmin(ModelAdmin):
class SharingSiteViewSet(SnippetViewSet):
model = SharingSite
menu_icon = "site"
icon = "site"
menu_order = 603
add_to_settings_menu = True
list_display = ("site", "hostname", "port")


modeladmin_register(SharingSiteModelAdmin)
register_snippet(SharingSiteViewSet)


@hooks.register("register_page_header_buttons")
Expand All @@ -35,7 +36,7 @@ def add_sharing_link(page, page_perms, is_parent=False, next_url=None):
sharing_url,
icon_name="draft",
attrs={
"title": _("View shared revision of '{}'").format(
"aria-label": _("View shared revision of '{}'").format(
page.get_admin_display_title()
),
},
Expand Down

0 comments on commit ff9f2fc

Please sign in to comment.