From c05ff782ef51f08ea5878b9f52de17a2f0424205 Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Thu, 18 Jul 2013 09:39:41 +0100 Subject: [PATCH] Altered FB mix template --- spa/management/commands/drop.py | 17 ++++++++++++++++- templates/inc/facebook/mix.html | 16 ++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/spa/management/commands/drop.py b/spa/management/commands/drop.py index 19fd4cf..ee433ac 100755 --- a/spa/management/commands/drop.py +++ b/spa/management/commands/drop.py @@ -2,9 +2,23 @@ from django.conf import settings from django.core.management.base import NoArgsCommand + class Command(NoArgsCommand): help = "Drop and re-create the database" + def handle_noargs(self, **options): + self.pgsql_handle_noargs(options) + + def pgsql_handle_noargs(self, **options): + import psycopg2 + db = psycopg2.connect("dbname=%s user=%s password=%s" % (settings.DATABASES['default']['NAME'], settings.DATABASES['default']['USER'], settings.DATABASES['default']['PASSWORD'])) + + cur = db.cursor() + cur.execute("drop database %s; create database %s;" % settings.DATABASES['default']['NAME'], settings.DATABASES['default']['NAME']) + + print "Dropped" + + def mysql_handle_noargs(self, **options): import MySQLdb print "Connecting..." @@ -16,6 +30,7 @@ class Command(NoArgsCommand): cursor = db.cursor() print "Dropping database %s" % settings.DATABASES['default']['NAME'] - cursor.execute("drop database %s; create database %s;" % (settings.DATABASES['default']['NAME'], settings.DATABASES['default']['NAME'])) + cursor.execute("drop database %s; create database %s;" % ( + settings.DATABASES['default']['NAME'], settings.DATABASES['default']['NAME'])) print "Dropped" diff --git a/templates/inc/facebook/mix.html b/templates/inc/facebook/mix.html index 552e403..b4c7c55 100755 --- a/templates/inc/facebook/mix.html +++ b/templates/inc/facebook/mix.html @@ -4,17 +4,13 @@ xmlns:fb="https://www.facebook.com/2008/fbml"> - + - - - - - - - - + + + + - + \ No newline at end of file