12468 use inverse match

This commit is contained in:
Arthur 2023-05-12 09:27:59 -07:00
parent d55162ce4f
commit 58c74b208c
2 changed files with 6 additions and 3 deletions

View File

@ -24,8 +24,9 @@ class Migration(migrations.Migration):
),
django.core.validators.RegexValidator(
flags=re.RegexFlag['IGNORECASE'],
inverse_match=True,
message='No double-underscores are allowed.',
regex='^(?!.*__.*)',
regex=r'__',
),
],
),

View File

@ -75,6 +75,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
null=True,
help_text=_('The type of NetBox object this field maps to (for object fields)')
)
# regex=r'^(?!.*__.*)', ^((?!__).)*$
name = models.CharField(
max_length=50,
unique=True,
@ -86,9 +87,10 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
flags=re.IGNORECASE
),
RegexValidator(
regex=r'^(?!.*__.*)',
regex=r'__',
message="No double-underscores are allowed.",
flags=re.IGNORECASE
flags=re.IGNORECASE,
inverse_match=True
),
)
)