chore: Migrate RelatedDocuments for RFCs
This commit is contained in:
parent
f53a849660
commit
563b5a9fe2
31
ietf/doc/migrations/0009_move_rfc_relateddocuments.py
Normal file
31
ietf/doc/migrations/0009_move_rfc_relateddocuments.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 4.2.3 on 2023-07-05 22:40
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
DocAlias = apps.get_model("doc", "DocAlias")
|
||||
Document = apps.get_model("doc", "Document")
|
||||
RelatedDocument = apps.get_model("doc", "RelatedDocument")
|
||||
for rfc_alias in DocAlias.objects.filter(name__startswith="rfc"):
|
||||
RelatedDocument.objects.filter(
|
||||
relationship__slug__in=(
|
||||
"tobcp",
|
||||
"toexp",
|
||||
"tohist",
|
||||
"toinf",
|
||||
"tois",
|
||||
"tops",
|
||||
"obs",
|
||||
"updates",
|
||||
),
|
||||
source__docalias=rfc_alias,
|
||||
).update(source=Document.objects.get(name=rfc_alias.name))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("doc", "0008_move_rfc_docevents"),
|
||||
]
|
||||
|
||||
operations = [migrations.RunPython(forward)]
|
|
@ -30,7 +30,7 @@ def forward(apps, schema_editor):
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("doc", "0008_move_rfc_docevents"),
|
||||
("doc", "0009_move_rfc_relateddocuments"),
|
||||
]
|
||||
|
||||
operations = [
|
Loading…
Reference in a new issue