]> git.parisson.com Git - teleforma.git/commitdiff
add conference delete command
authorGuillaume Pellerin <yomguy@parisson.com>
Sat, 1 Feb 2014 23:50:41 +0000 (00:50 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Sat, 1 Feb 2014 23:50:41 +0000 (00:50 +0100)
teleforma/management/commands/teleforma-delete-period-conferences.py [new file with mode: 0644]

diff --git a/teleforma/management/commands/teleforma-delete-period-conferences.py b/teleforma/management/commands/teleforma-delete-period-conferences.py
new file mode 100644 (file)
index 0000000..82e9e96
--- /dev/null
@@ -0,0 +1,23 @@
+from optparse import make_option
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+from telemeta.models import *
+from telemeta.util.unaccent import unaccent
+from teleforma.models import *
+
+
+class Command(BaseCommand):
+    help = "Delete all conferences fir a given period"
+    args = "period_name"
+    admin_email = 'webmaster@parisson.com'
+
+    def handle(self, *args, **options):
+        period_name = args[0]
+        period = Period.objects.get(name=period_name)
+        conferences = Conference.objects.filter(period=period)
+        for conference in conferences:
+            print conference.public_id
+            conference.delete()
+        
\ No newline at end of file