diff --git a/docs/release-notes/version-2.10.md b/docs/release-notes/version-2.10.md index 9bc10416a..69e31606f 100644 --- a/docs/release-notes/version-2.10.md +++ b/docs/release-notes/version-2.10.md @@ -12,6 +12,7 @@ * [#5543](https://github.com/netbox-community/netbox/issues/5543) - Fix rendering of config contexts with cluster assignment for devices * [#5546](https://github.com/netbox-community/netbox/issues/5546) - Add custom field bulk edit support for cables, power panels, rack reservations, and virtual chassis * [#5547](https://github.com/netbox-community/netbox/issues/5547) - Add custom field bulk import support for cables, power panels, rack reservations, and virtual chassis +* [#5558](https://github.com/netbox-community/netbox/issues/5558) - Fix regex validation support for custom URL fields --- diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index 693158bc5..a69816d21 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -196,7 +196,8 @@ class CustomField(models.Model): }) # Regex validation can be set only for text fields - if self.validation_regex and self.type != CustomFieldTypeChoices.TYPE_TEXT: + regex_types = (CustomFieldTypeChoices.TYPE_TEXT, CustomFieldTypeChoices.TYPE_URL) + if self.validation_regex and self.type not in regex_types: raise ValidationError({ 'validation_regex': "Regular expression validation is supported only for text and URL fields" })