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:
@ -6,6 +6,7 @@
|
||||
|
||||
* [#5442](https://github.com/netbox-community/netbox/issues/5442) - Fix assignment of permissions based on LDAP groups
|
||||
* [#6773](https://github.com/netbox-community/netbox/issues/6773) - Add missing `display` field to rack unit serializer
|
||||
* [#6777](https://github.com/netbox-community/netbox/issues/6777) - Fix default value validation for custom text fields
|
||||
* [#6778](https://github.com/netbox-community/netbox/issues/6778) - Rack reservation should display rack's location
|
||||
* [#6780](https://github.com/netbox-community/netbox/issues/6780) - Include rack location in navigation breadcrumbs
|
||||
|
||||
|
@ -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