Skip to content

Commit

Permalink
Add backwards-compatible locale verbose_name migration (#72)
Browse files Browse the repository at this point in the history
* 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.

* Remove Wagtail 6.0 from test matrix

Co-authored-by: Dan Braghiș <[email protected]>
  • Loading branch information
willbarton and zerolab committed Aug 13, 2024
1 parent 15b55aa commit eb0795c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.1,6.2}
python{3.10,3.11,3.12}-django5.0-wagtail{5.2,6.1,6.2}

[gh-actions]
python =
Expand All @@ -28,8 +28,8 @@ deps =
django5.0: Django>=5.0,<5.1

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
Expand Down
32 changes: 32 additions & 0 deletions wagtail_footnotes/migrations/0006_alter_footnote_locale.py
Original file line number Diff line number Diff line change
@@ -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",
),
)
)

0 comments on commit eb0795c

Please sign in to comment.