|
|
@@ -280,8 +280,10 @@ class CustomField(BigIDModel):
|
|
|
if value not in [None, '']:
|
|
|
|
|
|
# Validate text field
|
|
|
- if self.type == CustomFieldTypeChoices.TYPE_TEXT and self.validation_regex:
|
|
|
- if not re.match(self.validation_regex, value):
|
|
|
+ if self.type == CustomFieldTypeChoices.TYPE_TEXT:
|
|
|
+ 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}'")
|
|
|
|
|
|
# Validate integer
|