From 057975fb1e0948aee2fd74b8a2cede2db7046a97 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Thu, 16 Nov 2023 15:04:01 +0800 Subject: [PATCH] Add wagtail_modeladmin --- pyproject.toml | 1 + tests/settings.py | 4 +++- tests/testapp/wagtail_hooks.py | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3aa0ed9..1fb652b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ dependencies = [ testing = [ "coverage~=6.4.4", "tox~=3.26.0", + "wagtail-modeladmin~=1.0.0", ] [project.urls] diff --git a/tests/settings.py b/tests/settings.py index b7e3ad4..ce70302 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -10,6 +10,8 @@ import os +from wagtail import VERSION as WAGTAIL_VERSION + PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(PROJECT_DIR) @@ -38,7 +40,7 @@ "wagtail.search", "wagtail.admin", "wagtail.api.v2", - "wagtail.contrib.modeladmin", + "wagtail_modeladmin" if WAGTAIL_VERSION >= (5, 1) else "wagtail.contrib.modeladmin", "wagtail.contrib.routable_page", "wagtail.contrib.styleguide", "wagtail.sites", diff --git a/tests/testapp/wagtail_hooks.py b/tests/testapp/wagtail_hooks.py index 77270cc..277e24f 100644 --- a/tests/testapp/wagtail_hooks.py +++ b/tests/testapp/wagtail_hooks.py @@ -1,4 +1,9 @@ -from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register +from wagtail import VERSION as WAGTAIL_VERSION + +if WAGTAIL_VERSION >= (5, 1): + from wagtail_modeladmin.options import ModelAdmin, modeladmin_register +else: + from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register from wagtail_rangefilter.filters import DateRangeFilter, DateTimeRangeFilter