From 23fc0ea44aaf03222046126d9502274db82bd269 Mon Sep 17 00:00:00 2001 From: Robert Sparks <rjsparks@nostrum.com> Date: Thu, 28 Jul 2022 09:13:29 -0500 Subject: [PATCH] fix: add new search rule to correct group community lists (#4291) --- .../migrations/0009_add_group_exp_rule_to_groups.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ietf/community/migrations/0009_add_group_exp_rule_to_groups.py b/ietf/community/migrations/0009_add_group_exp_rule_to_groups.py index b2a9ae53c..1d3222dc6 100644 --- a/ietf/community/migrations/0009_add_group_exp_rule_to_groups.py +++ b/ietf/community/migrations/0009_add_group_exp_rule_to_groups.py @@ -6,12 +6,13 @@ from django.db import migrations def forward(apps, schema_editor): SearchRule = apps.get_model('community', 'SearchRule') + CommunityList = apps.get_model('community', 'CommunityList') Group = apps.get_model('group', 'Group') State = apps.get_model('doc', 'State') for group in Group.objects.filter(type_id__in=['wg','rg'], state_id='active'): - Rule = SearchRule.objects.filter(group = group) - if Rule.exists(): - SearchRule.objects.create(community_list=Rule[0].community_list, rule_type="group_exp", group=group, state=State.objects.get(slug="expired", type="draft"),) + com_list = CommunityList.objects.filter(group=group).first() + if com_list is not None: + SearchRule.objects.create(community_list=com_list, rule_type="group_exp", group=group, state=State.objects.get(slug="expired", type="draft"),) def reverse(apps, schema_editor):