diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-13 18:53:29 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-13 18:53:29 (GMT) |
commit | 103a909a999ecb8e2bce2cf84e4ec39968223a53 (patch) | |
tree | e219a86a6b468b736a47f21061916b114be54427 /helsinki/program/management/commands/importhosts.py | |
parent | ba41badf0171cd618034e4c9eb21893eaf1ccd90 (diff) |
getting real.
Diffstat (limited to 'helsinki/program/management/commands/importhosts.py')
-rw-r--r-- | helsinki/program/management/commands/importhosts.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/helsinki/program/management/commands/importhosts.py b/helsinki/program/management/commands/importhosts.py deleted file mode 100644 index 39a8afd..0000000 --- a/helsinki/program/management/commands/importhosts.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.core.management.base import NoArgsCommand - -import MySQLdb - -from helsinki.program.models import Host - -USER = 'helsinki' -PASSWD = 'helsinki' -DB = 'helsinki' - -class Command(NoArgsCommand): - help = 'Import hosts from current program' - - def handle_noargs(self, **options): - connection = MySQLdb.connect(user=USER, passwd=PASSWD, db=DB) - cursor = connection.cursor() - - cursor.execute("""SELECT DISTINCT macher -FROM sendungen -WHERE letzter_termin > current_date AND macher != '' AND titel NOT LIKE 'Musikprogramm'""") - - counter = 0 - - for row in cursor.fetchall(): - for macher in row[0].split(','): - host = Host(name=macher.strip()) - host.save() - - counter += 1 - - cursor.close() - connection.close() - - print '%i hosts imported' % counter |