diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index 439d15edc..635f9c882 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -81,8 +81,8 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel): help_text=_('Internal field name'), validators=( RegexValidator( - regex=r'^[a-z0-9_]+$', - message="Only alphanumeric characters and underscores are allowed.", + regex=r'^(?!.*__.*)^[a-z0-9_]+$', + message="Only alphanumeric characters and underscores (no double-underscores) are allowed.", flags=re.IGNORECASE ), )