From 00479a33ff6ed46b23ba2057838f92896e2b8f42 Mon Sep 17 00:00:00 2001 From: csalom Date: Wed, 22 May 2024 14:06:01 +0200 Subject: [PATCH] feat: add wagtail 6 support --- AUTHORS | 2 ++ CHANGELOG.md | 2 ++ puput/__init__.py | 1 + puput/routes.py | 7 ++++++- setup.py | 2 +- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index f35c7cf..556aab7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,3 +13,5 @@ * Yed Podtrzitko * Francisco Fernández * Pep Lluís Miró +* Wesley van Lee +* Marco Badan \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 28f697e..685e7af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Changelog Unreleased ---------- +* Add Wagtail 6.1 support. Drop Wagtail <=5.2 support. + 2.0.0 (2023-07-04) ------------------ diff --git a/puput/__init__.py b/puput/__init__.py index d925942..84dff05 100644 --- a/puput/__init__.py +++ b/puput/__init__.py @@ -15,6 +15,7 @@ "wagtail.sites", "wagtail.contrib.redirects", "wagtail.contrib.forms", + "wagtail.contrib.search_promotions", "wagtail.contrib.sitemaps", "wagtail.contrib.routable_page", "wagtail", diff --git a/puput/routes.py b/puput/routes.py index 871dc28..dab51aa 100644 --- a/puput/routes.py +++ b/puput/routes.py @@ -8,7 +8,12 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.models import Page -from wagtail.search.models import Query +import wagtail +if wagtail.VERSION[:2] < (6, 0): + from wagtail.search.models import Query +else: + # https://docs.wagtail.org/en/stable/releases/6.0.html#query-model-moved-to-wagtail-contrib-search-promotions + from wagtail.contrib.search_promotions.models import Query from .utils import get_object_or_None diff --git a/setup.py b/setup.py index 481c365..9f8dcb6 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def get_metadata(package, field): description='A Django blog app implemented in Wagtail.', long_description=codecs.open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read(), install_requires=[ - 'wagtail>=5.2', + 'wagtail>=5.2,<7.0', 'django-el-pagination==4.0.0', 'django-taggit>=3.1.0,<4.1', 'wagtail-markdown==0.11.1'