wagtail-metadata-mixin icon indicating copy to clipboard operation
wagtail-metadata-mixin copied to clipboard

Wagtail version 3+ compatibility

Open Siburg opened this issue 2 years ago • 2 comments

The package is currently limited to wagtail version >1.4 and <3.0. All of those versions are out of support: https://github.com/wagtail/wagtail/wiki/Release-schedule.

I propose to submit a PR that will:

  • fix the panels in the MetadataPageMixin so it will continue to work with Wagtail versions 3+;
  • increase minimum requirement for Wagtail to version 2.13, because it's the minimum version that supports Django 3.2;
  • upgrade the example app to use Django 3.2 and Wagtail 4.1, because those are LTS releases;

I think we could also drop support for Python 3.6, and add support for more recent Python versions.

I propose deploying the changes as a new version 3.0, because it will have breaking changes.

Siburg avatar Jun 03 '23 03:06 Siburg

please do

bashu avatar Jun 03 '23 03:06 bashu

On second thoughts, trying to maintain compatibility with wagtail versions before 3.0 looks too hard. The trouble is the changes to module paths (https://docs.wagtail.org/en/stable/releases/3.0.html#changes-to-module-paths) in Wagtail 3.0.

I started amending wagtailmetadata/models.py like this:

from wagtail import VERSION
if VERSION[0] >= 3:
    from wagtail.admin.panels import FieldPanel as SearchImagePanel
    from wagtail.models import Site
else:
    from wagtail.core.models import Site
    from wagtail.images.edit_handlers import ImageChooserPanel as SearchImagePanel

And then using panels = [SearchImagePanel("search_image")] in the MetadataPageMixin. That looks OK by itself to me.

However, there are many more locations where changes like that are needed. For example, in wagtailmetadata/tests/settings.py I used:

if VERSION[0] >= 3:
    wagtail_app_str = "wagtail"
else:
    wagtail_app_str = "wagtail.core"

so that I could use that wagtail_app_str in the INSTALLED_APPS and MIDDLEWARE settings.

But then I encountered the example/puput_migrations directory, and amending that for dual versions starts to become too impractical.

So I now propose to increase the minimum Wagtail version to 3.0. Users with older wagtail version will need to continue using a version 2 of this package.

Siburg avatar Jun 03 '23 07:06 Siburg