mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
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:
parent
5922d9fbff
commit
9beefd09f7
@ -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'),
|
||||
),
|
||||
]
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user