Пример #1
0
    def validate_primary_phone(self, attrs, source):
        international = attrs['international']
        number = attrs[source]

        if international:
            validators.phone_international(number)
        else:
            validators.phone_domestic(number)

        return attrs
Пример #2
0
    def validate_primary_phone(self, attrs, source):
        international = attrs['international']
        number = attrs[source]

        if international:
            validators.phone_international(number)
        else:
            validators.phone_domestic(number)

        return attrs
Пример #3
0
    def validate_secondary_phone(self, attrs, source):
        number = attrs.get(source)
        international = attrs['international']

        if number:
            if international:
                validators.phone_international(number)
            else:
                validators.phone_domestic(number)

        return attrs
Пример #4
0
    def validate_secondary_phone(self, attrs, source):
        number = attrs.get(source)
        international = attrs['international']

        if number:
            if international:
                validators.phone_international(number)
            else:
                validators.phone_domestic(number)

        return attrs
Пример #5
0
    def validate(self, data):
        international = data.get('international')
        primary_phone = data.get('primary_phone')
        secondary_phone = data.get('secondary_phone')

        if primary_phone:
            if international:
                validators.phone_international(primary_phone)
            else:
                validators.phone_domestic(primary_phone)
        if secondary_phone:
            if international:
                validators.phone_international(secondary_phone)
            else:
                validators.phone_domestic(secondary_phone)

        return data
Пример #6
0
    def validate(self, data):
        international = data.get('international')
        primary_phone = data.get('primary_phone')
        secondary_phone = data.get('secondary_phone')

        if primary_phone:
            if international:
                validators.phone_international(primary_phone)
            else:
                validators.phone_domestic(primary_phone)
        if secondary_phone:
            if international:
                validators.phone_international(secondary_phone)
            else:
                validators.phone_domestic(secondary_phone)

        return data
Пример #7
0
 def validate_phone(phone, international):
     if international:
         validators.phone_international(phone)
     else:
         validators.phone_domestic(phone)
Пример #8
0
 def validate_phone(phone, international):
     if international:
         validators.phone_international(phone)
     else:
         validators.phone_domestic(phone)