Skip to content

Commit af3c490

Browse files
committed
Fixes #5558: Fix regex validation support for custom URL fields
1 parent 7873952 commit af3c490

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/release-notes/version-2.10.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [#5543](https://github.com/netbox-community/netbox/issues/5543) - Fix rendering of config contexts with cluster assignment for devices
1313
* [#5546](https://github.com/netbox-community/netbox/issues/5546) - Add custom field bulk edit support for cables, power panels, rack reservations, and virtual chassis
1414
* [#5547](https://github.com/netbox-community/netbox/issues/5547) - Add custom field bulk import support for cables, power panels, rack reservations, and virtual chassis
15+
* [#5558](https://github.com/netbox-community/netbox/issues/5558) - Fix regex validation support for custom URL fields
1516

1617
---
1718

netbox/extras/models/customfields.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ def clean(self):
196196
})
197197

198198
# Regex validation can be set only for text fields
199-
if self.validation_regex and self.type != CustomFieldTypeChoices.TYPE_TEXT:
199+
regex_types = (CustomFieldTypeChoices.TYPE_TEXT, CustomFieldTypeChoices.TYPE_URL)
200+
if self.validation_regex and self.type not in regex_types:
200201
raise ValidationError({
201202
'validation_regex': "Regular expression validation is supported only for text and URL fields"
202203
})

0 commit comments

Comments
 (0)