示例#1
0
    def synchronize(cls):
        gateway = SmsGateway()
        senders = gateway.get_senders()

        for sender in senders:
            ss, created = cls.objects.get_or_create(name=sender)
            ss.active = True
            ss.save()

        cls.objects.all().exclude(name__in=senders).update(is_active=False)
示例#2
0
 def send(self):
     sms_id = None
     if self.status in [self.NEW, self.ERROR]:
         gateway = SmsGateway()
         try:
             sms_id = gateway.send_sms(self)
         except SmsError:
             self.status = self.ERROR
         else:
             self.status = self.SENT
             self.sms_id = sms_id
             if self.secure:
                 self.content = _('secure sms')
         self.save()
         post_send_sms.send(sender=Sms, sms=self)
     return sms_id
示例#3
0
def callback_delivery_report(request):
    gateway = SmsGateway()
    result = gateway.callback_delivery_report(request.GET or request.POST)
    return HttpResponse(result)
示例#4
0
def callback_received_sms(request):
    gateway = SmsGateway()
    result = gateway.callback_received_sms(request.GET or request.POST)
    return HttpResponse(result)