Beispiel #1
0
    def validate_phone2(self, attrs, source):
        try:
            value = clean_international_phonenumber(attrs[source])
        except KeyError:
            pass
        else:
            # Store formatted phone number
            attrs[source] = value

        return attrs
Beispiel #2
0
    def validate_alerting_phone(self, attrs, source):
        try:
            value = attrs[source]
        except KeyError:
            pass
        else:
            if value:
                # Store formatted phone number
                attrs[source] = clean_international_phonenumber(value)

        return attrs
Beispiel #3
0
    def validate_phone(self, attrs, source):
        try:
            value = clean_international_phonenumber(attrs[source])
        except KeyError:
            pass
        else:
            if self.object.phone == value:
                return attrs
            else:
                # Store old phone number for later so we know we have to send text message
                self.old_phone = self.object.phone
            # Store formatted phone number
            attrs[source] = value

        return attrs
Beispiel #4
0
 def clean_phone(self):
     return clean_international_phonenumber(self.cleaned_data['phone'])