Enforce uniqueness constraint

This commit is contained in:
Oliver Walters 2019-05-05 08:48:41 +10:00
parent 9919bebaa2
commit 919f04044b
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2 on 2019-05-04 22:48
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('part', '0016_partstar'),
]
operations = [
migrations.AlterUniqueTogether(
name='partstar',
unique_together={('part', 'user')},
),
]

View File

@ -439,6 +439,9 @@ class PartStar(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='starred_parts')
class Meta:
unique_together = ['part', 'user']
class BomItem(models.Model):
""" A BomItem links a part to its component items.