Ensure PartParameterTemplate name is unique

This commit is contained in:
Oliver Walters 2019-09-07 19:43:41 +10:00
parent 6752bdc1c6
commit 13270617b9
3 changed files with 21 additions and 1 deletions

2
.gitignore vendored
View File

@ -34,6 +34,8 @@ docs/_build
# Local static and media file storage (only when running in development mode) # Local static and media file storage (only when running in development mode)
InvenTree/media InvenTree/media
InvenTree/static InvenTree/static
media
static
# Local config file # Local config file
config.yaml config.yaml

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.4 on 2019-09-07 09:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0017_bomitem_checksum'),
]
operations = [
migrations.AlterField(
model_name='partparametertemplate',
name='name',
field=models.CharField(help_text='Parameter Name', max_length=100, unique=True),
),
]

View File

@ -1068,7 +1068,7 @@ class PartParameterTemplate(models.Model):
""" Return the number of instances of this Parameter Template """ """ Return the number of instances of this Parameter Template """
return self.instances.count() return self.instances.count()
name = models.CharField(max_length=100, help_text='Parameter Name') name = models.CharField(max_length=100, help_text='Parameter Name', unique=True)
units = models.CharField(max_length=25, help_text='Parameter Units', blank=True) units = models.CharField(max_length=25, help_text='Parameter Units', blank=True)