From 22b0430dcd1aaffbe185e12755a4b41b17dbbadc Mon Sep 17 00:00:00 2001 From: Will Barton Date: Mon, 5 Aug 2024 11:54:41 -0400 Subject: [PATCH] Add backwards-compatible locale verbose_name migration Wagtail 6.2 alters the Locale model on TranslatableMixin, adding a verbose_name. Because Footnote inherits from TranslatableMixin, it needs a new migration generated for Wagtail 6.2. To maintain compatibility with Wagtail <= 6.1, this change makes the migration a noop. See #71 for context. Closes #71 --- tox.ini | 5 +-- .../migrations/0006_alter_footnote_locale.py | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 wagtail_footnotes/migrations/0006_alter_footnote_locale.py diff --git a/tox.ini b/tox.ini index 159f0df..cfdab92 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ min_version = 4.0 envlist = - python{3.8,3.9,3.10,3.11}-django4.2-wagtail{5.2,6.0,6.1} - python{3.10,3.11,3.12}-django5.0-wagtail{5.2,6.0,6.1} + python{3.8,3.9,3.10,3.11}-django4.2-wagtail{5.2,6.0,6.1,6.2} + python{3.10,3.11,3.12}-django5.0-wagtail{5.2,6.0,6.1,6.2} [gh-actions] python = @@ -30,6 +30,7 @@ deps = wagtail5.2: wagtail>=5.2,<5.3 wagtail6.0: wagtail>=6.0,<6.1 wagtail6.1: wagtail>=6.1,<6.2 + wagtail6.2: wagtail>=6.2,<6.3 extras = testing diff --git a/wagtail_footnotes/migrations/0006_alter_footnote_locale.py b/wagtail_footnotes/migrations/0006_alter_footnote_locale.py new file mode 100644 index 0000000..32dd9a2 --- /dev/null +++ b/wagtail_footnotes/migrations/0006_alter_footnote_locale.py @@ -0,0 +1,32 @@ +# Generated by Django 4.2.14 on 2024-08-12 17:41 +import django.db.models.deletion + +from django.db import migrations, models +from wagtail import VERSION as WAGTAIL_VERSION + + +class Migration(migrations.Migration): + dependencies = [ + ("wagtailcore", "0094_alter_page_locale"), + ( + "wagtail_footnotes", + "0005_alter_footnote_locale_alter_footnote_translation_key", + ), + ] + + operations = [] + + if WAGTAIL_VERSION >= (6, 2): + operations.append( + migrations.AlterField( + model_name="footnote", + name="locale", + field=models.ForeignKey( + editable=False, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="wagtailcore.locale", + verbose_name="locale", + ), + ) + )