diff options
author | Ernesto Rico-Schmidt <ernesto.rico-schmidt@evolaris.net> | 2016-08-17 19:29:01 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <ernesto.rico-schmidt@evolaris.net> | 2016-08-17 19:29:01 (GMT) |
commit | 36f76b359c1e2c3dc98f1e02cf9bcab748f8b489 (patch) | |
tree | feefa308fce7bc892e79c75d2fa06dba182f82be /program/management | |
parent | 5983b58a07790f5f8f5fbe93be59a788189e4225 (diff) |
removed update_{hosts,programslots,shows} management commands.
Diffstat (limited to 'program/management')
-rw-r--r-- | program/management/commands/update_hosts.py | 29 | ||||
-rw-r--r-- | program/management/commands/update_programslots.py | 15 | ||||
-rw-r--r-- | program/management/commands/update_shows.py | 15 |
3 files changed, 0 insertions, 59 deletions
diff --git a/program/management/commands/update_hosts.py b/program/management/commands/update_hosts.py deleted file mode 100644 index 3cb143b..0000000 --- a/program/management/commands/update_hosts.py +++ /dev/null @@ -1,29 +0,0 @@ -from django.core.management.base import NoArgsCommand - -from program.models import Host - - -class Command(NoArgsCommand): - help = 'update host by setting is_active' - - def handle_noargs(self, **options): - activated = 0 - deactivated = 0 - - for host in Host.objects.all(): - active_shows = 0 - for show in host.shows.all(): - if show.is_active: - active_shows += 1 - else: - active_shows -= 1 - - host.is_active = active_shows > 0 - host.save() - - if host.is_active: - activated += 1 - else: - deactivated += 1 - - print "%s hosts activated, %s hosts de-activated " % (activated, deactivated) diff --git a/program/management/commands/update_programslots.py b/program/management/commands/update_programslots.py deleted file mode 100644 index 6f7ec90..0000000 --- a/program/management/commands/update_programslots.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import NoArgsCommand - -from program.models import ProgramSlot - -from datetime import datetime - - -class Command(NoArgsCommand): - help = 'update programslots by setting is_active' - - def handle_noargs(self, **options): - deactivated = ProgramSlot.objects.filter(until__lt=datetime.now()).update(is_active=False) - activated = ProgramSlot.objects.filter(until__gt=datetime.now()).update(is_active=True) - - print "%s program slots activated, %s program slots de-activated" % (activated, deactivated) diff --git a/program/management/commands/update_shows.py b/program/management/commands/update_shows.py deleted file mode 100644 index 0dafb88..0000000 --- a/program/management/commands/update_shows.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import NoArgsCommand - -from program.models import Show - -from datetime import datetime - - -class Command(NoArgsCommand): - help = 'update shows by setting is_active' - - def handle_noargs(self, **options): - deactivated = Show.objects.exclude(id=1).filter(programslots__until__lt=datetime.now()).update(is_active=False) - activated = Show.objects.exclude(id=1).filter(programslots__until__gt=datetime.now()).distinct().update(is_active=True) - - print "%s shows activated, %s shows de-activated" % (activated, deactivated) |