2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-05 13:10:57 +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

@ -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.