mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Fixes #6640: Disallow numeric values in custom text fields
This commit is contained in:
parent
ebb2918a88
commit
efa0fc2b09
@ -5,6 +5,7 @@
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* [#6626](https://github.com/netbox-community/netbox/issues/6626) - Fix site field on VM search form; add site group
|
* [#6626](https://github.com/netbox-community/netbox/issues/6626) - Fix site field on VM search form; add site group
|
||||||
|
* [#6640](https://github.com/netbox-community/netbox/issues/6640) - Disallow numeric values in custom text fields
|
||||||
* [#6652](https://github.com/netbox-community/netbox/issues/6652) - Fix exception when adding components in bulk to multiple devices
|
* [#6652](https://github.com/netbox-community/netbox/issues/6652) - Fix exception when adding components in bulk to multiple devices
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -280,8 +280,10 @@ class CustomField(BigIDModel):
|
|||||||
if value not in [None, '']:
|
if value not in [None, '']:
|
||||||
|
|
||||||
# Validate text field
|
# Validate text field
|
||||||
if self.type == CustomFieldTypeChoices.TYPE_TEXT and self.validation_regex:
|
if self.type == CustomFieldTypeChoices.TYPE_TEXT:
|
||||||
if not re.match(self.validation_regex, value):
|
if type(value) is not str:
|
||||||
|
raise ValidationError(f"Value must be a string.")
|
||||||
|
if self.validation_regex and not re.match(self.validation_regex, value):
|
||||||
raise ValidationError(f"Value must match regex '{self.validation_regex}'")
|
raise ValidationError(f"Value must match regex '{self.validation_regex}'")
|
||||||
|
|
||||||
# Validate integer
|
# Validate integer
|
||||||
|
Loading…
Reference in New Issue
Block a user