chore: Track RFCs if they were tracked as a draft
This commit is contained in:
parent
7d51781f4f
commit
71270621b7
27
ietf/community/migrations/0003_track_rfcs.py
Normal file
27
ietf/community/migrations/0003_track_rfcs.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 4.2.3 on 2023-07-07 18:33
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
"""Track any RFCs that were created from tracked drafts"""
|
||||
CommunityList = apps.get_model("community", "CommunityList")
|
||||
RelatedDocument = apps.get_model("doc", "RelatedDocument")
|
||||
|
||||
for cl in CommunityList.objects.all():
|
||||
for rfc in set(
|
||||
RelatedDocument.objects.filter(
|
||||
source__in=cl.added_docs.all(),
|
||||
relationship__slug="became_rfc",
|
||||
).values_list("target__docs", flat=True)
|
||||
):
|
||||
cl.added_docs.add(rfc)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("community", "0002_auto_20230320_1222"),
|
||||
("doc", "0010_move_rfc_docaliases"),
|
||||
]
|
||||
|
||||
operations = [migrations.RunPython(forward)]
|
Loading…
Reference in a new issue