summaryrefslogtreecommitdiff
path: root/program/management/commands/remove_automation_id.py
blob: 4fb8ee7ecb507b4a5e0d6565c0c6a24c25f048c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from django.core.management.base import BaseCommand, CommandError

from program.models import ProgramSlot


class Command(BaseCommand):
    help = 'removes the automation_id from the program slots'
    args = '<automation_id>'

    def handle(self, *args, **options):
        if len(args) == 1:
            automation_id = args[0]
        else:
            raise CommandError('you must provide the automation_id')

        ProgramSlot.objects.filter(automation_id=automation_id).update(automation_id=None)