2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Part parameter update (#3605)

* Adds 'description' field to PartParameterTemplate model

* Add 'description' field to API, update settings table

* Bump API version

* Allow more characters in PartParameterTemplate name
This commit is contained in:
Oliver
2022-08-25 07:33:36 +10:00
committed by GitHub
parent 6adfc91c5c
commit e8621a97bc
5 changed files with 43 additions and 5 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.15 on 2022-08-24 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0084_partcategory_icon'),
]
operations = [
migrations.AddField(
model_name='partparametertemplate',
name='description',
field=models.CharField(blank=True, help_text='Parameter description', max_length=250, verbose_name='Description'),
),
]

View File

@ -2369,7 +2369,7 @@ class PartTestTemplate(models.Model):
def validate_template_name(name):
"""Prevent illegal characters in "name" field for PartParameterTemplate."""
for c in "!@#$%^&*()<>{}[].,?/\\|~`_+-=\'\"": # noqa: P103
for c in "\"\'`!?|": # noqa: P103
if c in str(name):
raise ValidationError(_(f"Illegal character in template name ({c})"))
@ -2424,6 +2424,13 @@ class PartParameterTemplate(models.Model):
units = models.CharField(max_length=25, verbose_name=_('Units'), help_text=_('Parameter Units'), blank=True)
description = models.CharField(
max_length=250,
verbose_name=_('Description'),
help_text=_('Parameter description'),
blank=True,
)
class PartParameter(models.Model):
"""A PartParameter is a specific instance of a PartParameterTemplate. It assigns a particular parameter <key:value> pair to a part.

View File

@ -240,6 +240,7 @@ class PartParameterTemplateSerializer(InvenTreeModelSerializer):
'pk',
'name',
'units',
'description',
]