chore: Move/copy RelatedDocuments to rfcs
This commit is contained in:
parent
563b5a9fe2
commit
9f1b05a518
|
@ -7,7 +7,10 @@ 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"):
|
||||
for rfc_alias in DocAlias.objects.filter(name__startswith="rfc").exclude(
|
||||
docs__type__slug="rfc"
|
||||
):
|
||||
# Move these over to the RFC
|
||||
RelatedDocument.objects.filter(
|
||||
relationship__slug__in=(
|
||||
"tobcp",
|
||||
|
@ -21,6 +24,17 @@ def forward(apps, schema_editor):
|
|||
),
|
||||
source__docalias=rfc_alias,
|
||||
).update(source=Document.objects.get(name=rfc_alias.name))
|
||||
# Duplicate references on the RFC but keep the ones on the draft as well
|
||||
originals = list(
|
||||
RelatedDocument.objects.filter(
|
||||
relationship__slug__in=("refinfo", "refnorm", "refold", "refunk"),
|
||||
source__docalias=rfc_alias,
|
||||
)
|
||||
)
|
||||
for o in originals:
|
||||
o.pk = None
|
||||
o.source = Document.objects.get(name=rfc_alias.name)
|
||||
RelatedDocument.objects.bulk_create(originals)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
|
@ -30,7 +30,7 @@ def forward(apps, schema_editor):
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("doc", "0009_move_rfc_relateddocuments"),
|
||||
("doc", "0009_rfc_relateddocuments"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
Loading…
Reference in a new issue