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'), help_text=_('Internal field name'),
validators=( validators=(
RegexValidator( RegexValidator(
regex=r'^[a-z0-9_]+$', regex=r'^(?!.*__.*)^[a-z0-9_]+$',
message="Only alphanumeric characters and underscores are allowed.", message="Only alphanumeric characters and underscores (no double-underscores) are allowed.",
flags=re.IGNORECASE flags=re.IGNORECASE
), ),
) )