From 4310aa5d95d0b174320c2781da8fa9ee7743721a Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Sun, 2 Feb 2014 00:50:41 +0100 Subject: [PATCH] add conference delete command --- .../teleforma-delete-period-conferences.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 teleforma/management/commands/teleforma-delete-period-conferences.py diff --git a/teleforma/management/commands/teleforma-delete-period-conferences.py b/teleforma/management/commands/teleforma-delete-period-conferences.py new file mode 100644 index 00000000..82e9e963 --- /dev/null +++ b/teleforma/management/commands/teleforma-delete-period-conferences.py @@ -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 -- 2.39.5