def handle(self, *args, **kwargs):
        valid_domains = ['@stud.ntnu.no', '@ntnu.no']
        for campain_id in args:
            #error, if the campaign does not exist
            try:
                campain = Campaign.objects.filter(pk=int(campain_id))
            except Campaign.DoesNotExist:
                raise CommandError('Campaign ID %s does not exits' %campain_id)

            signatures_qs = Signature.objects.filter(
                    campaign__pk =  int(campain_id))
            for domain in valid_domains:
                signatures_qs = signatures_qs.exclude(email__endswith = domain)

            for signature in signatures_qs:
                signature.delete()
dataset/ETHPy150Open dotKom/onlinepetition/onlinepetition/petition/management/commands/delete_none_ntnu.py/Command.handle/original