mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #6777: Fix default value validation for custom text fields
This commit is contained in:
@ -149,7 +149,8 @@ class CustomField(BigIDModel):
|
||||
# Validate the field's default value (if any)
|
||||
if self.default is not None:
|
||||
try:
|
||||
self.validate(self.default)
|
||||
default_value = str(self.default) if self.type == CustomFieldTypeChoices.TYPE_TEXT else self.default
|
||||
self.validate(default_value)
|
||||
except ValidationError as err:
|
||||
raise ValidationError({
|
||||
'default': f'Invalid default value "{self.default}": {err.message}'
|
||||
|
Reference in New Issue
Block a user