diff --git a/network-api/networkapi/wagtailpages/migrations/0130_fix_urls_on_translation_context_model.py b/network-api/networkapi/wagtailpages/migrations/0130_fix_urls_on_translation_context_model.py new file mode 100644 index 00000000000..cb4711df2a9 --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0130_fix_urls_on_translation_context_model.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.10 on 2024-03-19 15:42 + +from django.db import migrations + + +def fix_urls_on_translation_context_model(apps, schema_editor): + TranslationContext = apps.get_model("wagtail_localize", "TranslationContext") + contexts = TranslationContext.objects.filter(path__endswith=".URL") + + for context in contexts: + context.path = context.path.replace(".URL", ".external_url") + if context.field_path: + context.field_path = context.field_path.replace(".URL", ".external_url") + context.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0129_allow_spacer_on_articlepage_body"), + ] + + operations = [ + migrations.RunPython(fix_urls_on_translation_context_model, reverse_code=migrations.RunPython.noop), + ]