(self)
return result
Expects a list of [{"phone_number": <phone number>}] as the value.
Expects a list of [{"phone_number": <phone number>}] as the value.
Expects a list of [ { phone_number : <phone number > } ] as the value .
def clean_phone_numbers(self):
        """
        Expects a list of [{"phone_number": <phone number>}] as the value.
        """
        value = self.cleaned_data.get("phone_numbers")
        result = []
        try:
            value = json.loads(value)
            assert isinstance(value, list)
            for item in value:
                assert isinstance(item, dict)
                assert "phone_number" in item
                result.append(item["phone_number"])
        except (AssertionError, ValueError):
            raise ValidationError(_("Something went wrong. Please reload the "
                "page and try again."))

        if len(result) == 0:
            raise ValidationError(_("You must specify at least one phone"
                "number."))

        for phone_number in result:
            self.validate_phone_number(phone_number)

        return result
def clean_phone_numbers ( self ) : value = self . cleaned_data . get ( "phone_numbers" ) result = [ ] try : value = json . loads ( value ) assert isinstance ( value , list ) for item in value : assert isinstance ( item , dict ) assert "phone_number" in item result . append ( item [ "phone_number" ] ) except ( AssertionError , ValueError ) : raise ValidationError ( _ ( "Something went wrong. Please reload the " "page and try again." ) ) if len ( result ) == 0 : raise ValidationError ( _ ( "You must specify at least one phone" "number." ) ) for phone_number in result : self . validate_phone_number ( phone_number ) return result