diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2016-03-27 18:38:29 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2016-03-27 18:38:29 (GMT) |
commit | 6c29ea12d96094cf1b71e6c2f22043bf92d32bcb (patch) | |
tree | 31b0b3e0187065ccfe1f479bb6689d424c022c68 /program/management/commands/update_programslots.py | |
parent | 94af0c6f391fc21f14047a8d649d4d4e8697afea (diff) |
fixed update commands
Diffstat (limited to 'program/management/commands/update_programslots.py')
-rw-r--r-- | program/management/commands/update_programslots.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/program/management/commands/update_programslots.py b/program/management/commands/update_programslots.py index 62de064..f0cc59d 100644 --- a/program/management/commands/update_programslots.py +++ b/program/management/commands/update_programslots.py @@ -9,6 +9,16 @@ class Command(NoArgsCommand): help = 'update programslots by setting is_active' def handle_noargs(self, **options): + activated = 0 + deactivated = 0 + for programslot in ProgramSlot.objects.all(): programslot.is_active = programslot.until > date.today() programslot.save() + + if programslot.is_active: + activated += 1 + else: + deactivated += 1 + + print "%s program slots activated, %s program slots de-activated" % (activated, deactivated) |