<s> from django . core . management . base import BaseCommand , CommandError <EOL> from petition . models import Signature <EOL> from petition . models import Campaign <EOL> class Command ( BaseCommand ) : <EOL> help = "<STR_LIT>" "<STR_LIT>" <EOL> def handle ( self , * args , ** kwargs ) : <EOL> valid_domains = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> for campain_id in args : <EOL> try : <EOL> campain = Campaign . objects . filter ( pk = int ( campain_id ) ) <EOL> except Campaign . DoesNotExist : <EOL> raise CommandError ( '<STR_LIT>' % campain_id ) <EOL> signatures_qs = Signature . objects . filter ( <EOL> campaign__pk = int ( campain_id ) ) <EOL> for domain in valid_domains : <EOL> signatures_qs = signatures_qs . exclude ( email__endswith = domain ) <EOL> for signature in signatures_qs : <EOL> signature . delete ( ) </s>
