Remove special character restrictions in parameter template names (#3883)

* Remove special character restrictions in parameter template names

Fixes #3852

* Added migration
This commit is contained in:
Miklós Márton 2022-10-31 01:28:49 +01:00 committed by GitHub
parent 5922d9fbff
commit 9beefd09f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.16 on 2022-10-30 23:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0087_bomitem_consumable'),
]
operations = [
migrations.AlterField(
model_name='partparametertemplate',
name='name',
field=models.CharField(help_text='Parameter Name', max_length=100, unique=True, verbose_name='Name'),
),
]

View File

@ -2383,10 +2383,7 @@ class PartTestTemplate(models.Model):
def validate_template_name(name):
"""Prevent illegal characters in "name" field for PartParameterTemplate."""
for c in "\"\'`!?|": # noqa: P103
if c in str(name):
raise ValidationError(_(f"Illegal character in template name ({c})"))
"""Placeholder for legacy function used in migrations."""
class PartParameterTemplate(models.Model):
@ -2431,10 +2428,7 @@ class PartParameterTemplate(models.Model):
max_length=100,
verbose_name=_('Name'),
help_text=_('Parameter Name'),
unique=True,
validators=[
validate_template_name,
]
unique=True
)
units = models.CharField(max_length=25, verbose_name=_('Units'), help_text=_('Parameter Units'), blank=True)