def to_python(self, value): """Verifies that the value is a string with a valid CIDR IP address""" if value and not is_valid_cidr(value) and not is_valid_ip(value): raise exceptions.ValidationError( "Value must be a valid CIDR address") else: return value
def to_python(self, value): """Verifies that the value is a string with a valid CIDR IP address""" if value: if isinstance(value, six.binary_type): value = six.text_type(value, encoding='utf-8') if not is_valid_cidr(value) and not is_valid_ip(value): raise exceptions.ValidationError("Value must be a valid CIDR address") return value
def validate_cidr(value): """Validator for cidr xxx.xxx.xxx.xxx/xx""" if not value or not is_valid_cidr(value): raise forms.ValidationError('Must be a valid CIDR address!')
def clean(self, value): if value and not is_valid_cidr(value): raise forms.ValidationError("Value must be a valid CIDR address") else: return super(CIDRField, self).clean(value)
def clean(self, value): if value and not is_valid_cidr(value): raise forms.ValidationError( "Value must be a valid CIDR address") else: return super(CIDRField, self).clean(value)
def validate_cidr(value): """Validator for cidr xxx.xxx.xxx.xxx/xx""" if not value or not is_valid_cidr(value): raise forms.ValidationError( 'Must be a valid CIDR address!')