Skip populate_volunteers forward migration if nomcom2021 is not in the database. Fixes #3306. Commit ready for merge.

- Legacy-Id: 19132
This commit is contained in:
Jennifer Richards 2021-06-15 12:37:23 +00:00
parent 9a0d818490
commit d4271e0525

View file

@ -5,7 +5,9 @@ from django.db import migrations
def forward(apps, schema_editor):
NomCom = apps.get_model('nomcom','NomCom')
nc = NomCom.objects.get(group__acronym='nomcom2021')
nc = NomCom.objects.filter(group__acronym='nomcom2021').first()
if nc is None:
return # nothing to do if the NomCom in question does not exist
nc.is_accepting_volunteers = True
nc.save()