diff --git a/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py b/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py index fab5a3315d7b526ae522af27cd582df0a0721d6e..0f2d35214b34f807d345f5f1cf77b192ef08f3b8 100644 --- a/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py +++ b/hypha/apply/funds/migrations/0082_migrate_screening_status_to_screening_statuses.py @@ -10,10 +10,18 @@ def make_many_screening_statuses(apps, schema_editor): """ ApplicationSubmission = apps.get_model('funds', 'ApplicationSubmission') - for submission in ApplicationSubmission.objects.all(): + for submission in ApplicationSubmission.objects.filter(screening_status__isnull=False): if submission.screening_status: submission.screening_statuses.add(submission.screening_status) + ScreeningStatus = apps.get_model('funds', 'ScreeningStatus') + + if not ScreeningStatus.objects.filter(yes=True).exists(): + ScreeningStatus.objects.create(title='Accept', yes=True, default=True) + + if not ScreeningStatus.objects.filter(yes=False).exists(): + ScreeningStatus.objects.create(title='Dismiss', yes=False, default=True) + class Migration(migrations.Migration):