From 13270617b9b656dab07e3dfb57c3ce0ae781be72 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 7 Sep 2019 19:43:41 +1000 Subject: [PATCH] Ensure PartParameterTemplate name is unique --- .gitignore | 2 ++ .../part/migrations/0018_auto_20190907_0941.py | 18 ++++++++++++++++++ InvenTree/part/models.py | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 InvenTree/part/migrations/0018_auto_20190907_0941.py diff --git a/.gitignore b/.gitignore index 3866c30c95..7b9522c3b7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ docs/_build # Local static and media file storage (only when running in development mode) InvenTree/media InvenTree/static +media +static # Local config file config.yaml diff --git a/InvenTree/part/migrations/0018_auto_20190907_0941.py b/InvenTree/part/migrations/0018_auto_20190907_0941.py new file mode 100644 index 0000000000..539759146b --- /dev/null +++ b/InvenTree/part/migrations/0018_auto_20190907_0941.py @@ -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), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index b13b6632c1..4590a062a8 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1068,7 +1068,7 @@ class PartParameterTemplate(models.Model): """ Return the number of instances of this Parameter Template """ 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)