Added a data migration to fix up some incorrect external URLs for reviews.

- Legacy-Id: 17402
This commit is contained in:
Henrik Levkowetz 2020-03-07 14:21:41 +00:00
parent 89ec88dd7d
commit 638fbc592e

View file

@ -0,0 +1,37 @@
# Copyright The IETF Trust 2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 14:27
from __future__ import absolute_import, print_function, unicode_literals
import re
from django.conf import settings
from django.db import migrations
def forward(apps, schema_editor):
Document = apps.get_model('doc', 'Document')
print('')
for d in Document.objects.filter(external_url__contains="/b'"):
match = re.search("^(%s/arch/msg/[^/]+/)b'([^']+)'$" % settings.MAILING_LIST_ARCHIVE_URL, d.external_url)
if match:
d.external_url = "%s%s" % (match.group(1), match.group(2))
d.save()
print('Fixed url #%s: %s' % (d.id, d.external_url))
def reverse(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('doc', '0029_add_ipr_event_types'),
]
operations = [
migrations.RunPython(forward, reverse),
]