1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #9823 - Make validation error from NumericArrayField more verbose.

This commit is contained in:
Daniel Sheppard
2022-09-02 13:48:15 -05:00
parent a7717b432e
commit c42f7ab6d3

View File

@ -110,6 +110,13 @@ class SelectSpeedWidget(forms.NumberInput):
class NumericArrayField(SimpleArrayField):
def clean(self, value):
if value and not self.to_python(value):
raise forms.ValidationError(f'Invalid list ({value}). '
f'Must be numeric and ranges must be in ascending order')
return super().clean(value)
def to_python(self, value):
if not value:
return []