@@ -0,0 +1,1390 @@
+from django.core.exceptions import ObjectDoesNotExist%0Afrom django.core.management.base import BaseCommand, CommandError%0A%0Afrom subscriptions.models import Subscription%0A%0A%0Aclass Command(BaseCommand):%0A    help = (%22Active subscription holders need to be informed via audio file %22%0A            %22about the new missed call service.%22)%0A%0A    def handle(self, *args, **options):%0A        self.stdout.write(%22Processing active subscriptions ...%22)%0A        count = 0%0A        try:%0A            active_subscriptions_list = list(%0A                Subscription.objects.filter(active=True))%0A        except ObjectDoesNotExist:%0A            self.stdout.write(%22No active subscriptions found%22)%0A        if len(active_subscriptions_list) %3E 0:%0A            for active_subscription in active_subscriptions_list:%0A                # Add audio file to subscription meta_data. Not sure how we'll%0A                # handle translations here.%0A                if (active_subscription.metadata is not None and%0A                        %22welcome_message%22 not in active_subscription.metadata):%0A                    active_subscription%5B%22audo_file_url%22%5D = %22audio_file_url%22%0A                    count += 1%0A        if count %3E 0:%0A            self.stdout.write(%0A                %22Update %7B%7D subscriptions with voice notes%22.format(count))%0A        else:%0A            self.stdout.write(%0A                %22No subscriptions updated with audio file notes%22)%0A

Add missed call service audio notification to active subscriptions