Skip to content

Commit

Permalink
chore: add a migration command to create needed proposal drafts (#2931)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast authored Apr 16, 2024
1 parent 8f3d591 commit 4eda910
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.core.management.base import BaseCommand

from applications.models import AhjoDecisionProposalDraft, Application


class Command(BaseCommand):
help = "Create decision proposal drafts for older than 2024-04-16 applications"

def handle(self, *args, **options):
applications = Application.objects.all()
total_created = 0
for application in applications:
try:
application.decision_proposal_draft
except: # noqa
AhjoDecisionProposalDraft.objects.create(
application=application,
)
total_created += 1
self.stdout.write(f"Created {total_created} decision proposal drafts")

0 comments on commit 4eda910

Please sign in to comment.