Beispiel #1
0
def sms_reply(request):
    if request.method == "POST":
        from_number = format_number(request.POST['From'])
        message = request.POST['Body']
    elif request.method == "GET":
        from_number = format_number(request.GET['From'])
        message = request.GET['Body']
        
    r = Response()
    reply = gen_reply(from_number, message)
    if reply != None: r.message(reply)
    
    return r
Beispiel #2
0
def sms_reply(request):
    if request.method == "POST":
        from_number = format_number(request.POST['From'])
        message = request.POST['Body']
    elif request.method == "GET":
        from_number = format_number(request.GET['From'])
        message = request.GET['Body']

    r = Response()
    reply = gen_reply(from_number, message)
    if reply != None: r.message(reply)

    return r
Beispiel #3
0
    def save(self, *args, **kwargs):
        self.phone_number = format_number(self.phone_number)
        if not self.pk:
            chk = send_test_message(self)
            if chk[0] != 0:
                raise ValueError(chk[1])

        super(Number, self).save(*args, **kwargs)
Beispiel #4
0
    def save(self, *args, **kwargs):
        self.phone_number = format_number(self.phone_number)
        if not self.pk:
            chk = send_test_message(self)
            if chk[0] != 0:
                raise ValueError(chk[1])

        super(Number, self).save(*args, **kwargs)
Beispiel #5
0
def add_other_user(parm):
    new_number = ''.join([d for d in parm if d.isdigit()])
    new_number = format_number(new_number)
    
    subObj = extract_subscription(parm)
    
    if number_exist(new_number) == None:
        chk = add_user(new_number, "Subscribe " + subObj.name)
        out = new_number + " has been subscribed to " + subObj.name + "!"
    else: out = new_number + " is already a user and cannot be added to " + subObj.name + "."
    
    return(out)