-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: merge main to release (PR #6967)
ci: merge main to release
- Loading branch information
Showing
52 changed files
with
1,480 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
ietf/community/migrations/0004_delete_useless_community_lists.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.9 on 2024-01-05 21:28 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def forward(apps, schema_editor): | ||
CommunityList = apps.get_model("community", "CommunityList") | ||
# As of 2024-01-05, there are 570 personal CommunityLists with a user | ||
# who has no associated Person. None of these has an EmailSubscription, | ||
# so the lists are doing nothing and can be safely deleted. | ||
personal_lists_no_person = CommunityList.objects.exclude( | ||
user__isnull=True | ||
).filter( | ||
user__person__isnull=True | ||
) | ||
# Confirm the assumption that none of the lists to be deleted has an EmailSubscription | ||
assert not personal_lists_no_person.filter(emailsubscription__isnull=False).exists() | ||
personal_lists_no_person.delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("community", "0003_track_rfcs"), | ||
] | ||
|
||
operations = [migrations.RunPython(forward)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Generated by Django 4.2.2 on 2023-06-12 19:35 | ||
|
||
from django.conf import settings | ||
from django.db import migrations | ||
import django.db.models.deletion | ||
import ietf.utils.models | ||
|
||
|
||
def forward(apps, schema_editor): | ||
CommunityList = apps.get_model('community', 'CommunityList') | ||
for clist in CommunityList.objects.all(): | ||
try: | ||
clist.person = clist.user.person | ||
except: | ||
clist.person = None | ||
clist.save() | ||
|
||
def reverse(apps, schema_editor): | ||
CommunityList = apps.get_model('community', 'CommunityList') | ||
for clist in CommunityList.objects.all(): | ||
try: | ||
clist.user = clist.person.user | ||
except: | ||
clist.user = None | ||
clist.save() | ||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("community", "0004_delete_useless_community_lists"), | ||
("person", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="communitylist", | ||
name="person", | ||
field=ietf.utils.models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="person.Person", | ||
), | ||
), | ||
migrations.RunPython(forward, reverse), | ||
migrations.RemoveField( | ||
model_name="communitylist", | ||
name="user", | ||
field=ietf.utils.models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.