12468 review changes

This commit is contained in:
Arthur 2023-05-11 08:12:11 -07:00
parent 94daf74635
commit 629669e786
3 changed files with 30 additions and 32 deletions

View File

@ -1,6 +1,8 @@
# Generated by Django 4.1.7 on 2023-03-27 17:31
from django.db import migrations
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
@ -13,4 +15,24 @@ class Migration(migrations.Migration):
migrations.DeleteModel(
name='JobResult',
),
migrations.AlterField(
model_name='customfield',
name='name',
field=models.CharField(
max_length=50,
unique=True,
validators=[
django.core.validators.RegexValidator(
flags=re.RegexFlag['IGNORECASE'],
message='Only alphanumeric characters and underscores are allowed.',
regex='^[a-z0-9_]+$',
),
django.core.validators.RegexValidator(
flags=re.RegexFlag['IGNORECASE'],
message='No double-underscores are allowed.',
regex='^(?!.*__.*)',
),
],
),
),
]

View File

@ -1,29 +0,0 @@
# Generated by Django 4.1.8 on 2023-05-08 15:57
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('extras', '0092_delete_jobresult'),
]
operations = [
migrations.AlterField(
model_name='customfield',
name='name',
field=models.CharField(
max_length=50,
unique=True,
validators=[
django.core.validators.RegexValidator(
flags=re.RegexFlag['IGNORECASE'],
message='Only alphanumeric characters and underscores (no double-underscores) are allowed.',
regex='^(?!.*__.*)^[a-z0-9_]+$',
)
],
),
),
]

View File

@ -81,8 +81,13 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
help_text=_('Internal field name'),
validators=(
RegexValidator(
regex=r'^(?!.*__.*)^[a-z0-9_]+$',
message="Only alphanumeric characters and underscores (no double-underscores) are allowed.",
regex=r'^[a-z0-9_]+$',
message="Only alphanumeric characters and underscores are allowed.",
flags=re.IGNORECASE
),
RegexValidator(
regex=r'^(?!.*__.*)',
message="No double-underscores are allowed.",
flags=re.IGNORECASE
),
)