summaryrefslogtreecommitdiff
path: root/program/management/commands/update_programslots.py
blob: 62de0643ef2fab90a830b1d3aabbd095df0a288d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from django.core.management.base import NoArgsCommand

from program.models import ProgramSlot

from datetime import date


class Command(NoArgsCommand):
    help = 'update programslots by setting is_active'

    def handle_noargs(self, **options):
        for programslot in ProgramSlot.objects.all():
            programslot.is_active = programslot.until > date.today()
            programslot.save()