12468 disallow double underscores in custom field names

This commit is contained in:
Arthur 2023-05-08 08:57:14 -07:00
parent 259d0e96f2
commit 280ee13361

View File

@ -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
),
)