mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
6adfc91c5c
commit
e8621a97bc
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 72
|
INVENTREE_API_VERSION = 73
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
Increment this API version number whenever there is a significant change to the API that any clients need to know about
|
||||||
|
|
||||||
|
v73 -> 2022-08-24 : https://github.com/inventree/InvenTree/pull/3605
|
||||||
|
- Add 'description' field to PartParameterTemplate model
|
||||||
|
|
||||||
v72 -> 2022-08-18 : https://github.com/inventree/InvenTree/pull/3567
|
v72 -> 2022-08-18 : https://github.com/inventree/InvenTree/pull/3567
|
||||||
- Allow PurchaseOrder to be duplicated via the API
|
- Allow PurchaseOrder to be duplicated via the API
|
||||||
|
|
||||||
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
@ -2369,7 +2369,7 @@ class PartTestTemplate(models.Model):
|
|||||||
|
|
||||||
def validate_template_name(name):
|
def validate_template_name(name):
|
||||||
"""Prevent illegal characters in "name" field for PartParameterTemplate."""
|
"""Prevent illegal characters in "name" field for PartParameterTemplate."""
|
||||||
for c in "!@#$%^&*()<>{}[].,?/\\|~`_+-=\'\"": # noqa: P103
|
for c in "\"\'`!?|": # noqa: P103
|
||||||
if c in str(name):
|
if c in str(name):
|
||||||
raise ValidationError(_(f"Illegal character in template name ({c})"))
|
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)
|
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):
|
class PartParameter(models.Model):
|
||||||
"""A PartParameter is a specific instance of a PartParameterTemplate. It assigns a particular parameter <key:value> pair to a part.
|
"""A PartParameter is a specific instance of a PartParameterTemplate. It assigns a particular parameter <key:value> pair to a part.
|
||||||
|
@ -240,6 +240,7 @@ class PartParameterTemplateSerializer(InvenTreeModelSerializer):
|
|||||||
'pk',
|
'pk',
|
||||||
'name',
|
'name',
|
||||||
'units',
|
'units',
|
||||||
|
'description',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,16 +345,23 @@ $("#param-table").inventreeTable({
|
|||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '{% trans "Name" %}',
|
title: '{% trans "Name" %}',
|
||||||
sortable: 'true',
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'units',
|
field: 'units',
|
||||||
title: '{% trans "Units" %}',
|
title: '{% trans "Units" %}',
|
||||||
sortable: 'true',
|
sortable: true,
|
||||||
|
switchable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
title: '{% trans "Description" %}',
|
||||||
|
sortable: false,
|
||||||
|
switchable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
|
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit icon-green'></span></button>";
|
||||||
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
||||||
|
|
||||||
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
|
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
|
||||||
@ -370,6 +377,7 @@ $("#new-param").click(function() {
|
|||||||
fields: {
|
fields: {
|
||||||
name: {},
|
name: {},
|
||||||
units: {},
|
units: {},
|
||||||
|
description: {},
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
title: '{% trans "Create Part Parameter Template" %}',
|
title: '{% trans "Create Part Parameter Template" %}',
|
||||||
@ -389,6 +397,7 @@ $("#param-table").on('click', '.template-edit', function() {
|
|||||||
fields: {
|
fields: {
|
||||||
name: {},
|
name: {},
|
||||||
units: {},
|
units: {},
|
||||||
|
description: {},
|
||||||
},
|
},
|
||||||
title: '{% trans "Edit Part Parameter Template" %}',
|
title: '{% trans "Edit Part Parameter Template" %}',
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user