summaryrefslogtreecommitdiff
path: root/program/management/commands/importhosts.py
diff options
context:
space:
mode:
authorJohannes Raggam <raggam-nl@adm.at>2011-03-26 19:36:39 (GMT)
committerJohannes Raggam <raggam-nl@adm.at>2011-03-26 19:36:39 (GMT)
commit1f384ccf609e4d8cea4ac15c789d044ab6fa86f7 (patch)
treecabede5815519adcce80cfa5aeee239873221b11 /program/management/commands/importhosts.py
parent5504c0d926aabb2017e547bfbfbcf986ce5ee037 (diff)
creating an egg pt2
Diffstat (limited to 'program/management/commands/importhosts.py')
-rw-r--r--program/management/commands/importhosts.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/program/management/commands/importhosts.py b/program/management/commands/importhosts.py
deleted file mode 100644
index 39a8afd..0000000
--- a/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