management command to set active campaigns to UNSUCCESSFUL, trigger amazon notice

pull/1/head
eric 2012-08-09 09:47:10 -04:00
parent e928a2dfa1
commit 3d7cd7fdae
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
"""
print user emails
"""
from django.core.management.base import BaseCommand
from regluit.core import models, signals
class Command(BaseCommand):
help = "set active campaigns to unsuccessful"
def handle(self, **options):
for campaign in models.Campaign.objects.filter(status='ACTIVE'):
campaign.status = 'UNSUCCESSFUL'
campaign.save()
action = models.CampaignAction(campaign=campaign, type='failed', comment = 'amazon suspension')
action.save()
signals.amazon_suspension.send(sender=None,campaign=campaign)
print 'campaign %s set to UNSUCCESSFUL' % campaign.id