From 09c0b3e3a7ecb060344690bcbc7daf48236f4e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 30 Sep 2015 22:15:25 +0300 Subject: [PATCH] This was "run once" command that we don't need any more --- hc/api/management/commands/makechannels.py | 32 ---------------------- 1 file changed, 32 deletions(-) delete mode 100644 hc/api/management/commands/makechannels.py diff --git a/hc/api/management/commands/makechannels.py b/hc/api/management/commands/makechannels.py deleted file mode 100644 index 20d2afa4..00000000 --- a/hc/api/management/commands/makechannels.py +++ /dev/null @@ -1,32 +0,0 @@ -import sys - -from django.core.management.base import BaseCommand - -from django.contrib.auth.models import User -from hc.api.models import Channel, Check - - -def _log(message): - sys.stdout.write(message) - sys.stdout.flush() - - -class Command(BaseCommand): - help = 'Sends UP/DOWN email alerts' - - def handle(self, *args, **options): - - for user in User.objects.all(): - q = Channel.objects.filter(user=user) - q = q.filter(kind="email", email_verified=True, value=user.email) - if q.count() > 0: - continue - - print("Creating default channel for %s" % user.email) - channel = Channel(user=user) - channel.kind = "email" - channel.value = user.email - channel.email_verified = True - channel.save() - - channel.checks.add(*Check.objects.filter(user=user))