mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Enforce uniqueness constraint
This commit is contained in:
parent
9919bebaa2
commit
919f04044b
19
InvenTree/part/migrations/0017_auto_20190505_0848.py
Normal file
19
InvenTree/part/migrations/0017_auto_20190505_0848.py
Normal 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')},
|
||||||
|
),
|
||||||
|
]
|
@ -439,6 +439,9 @@ class PartStar(models.Model):
|
|||||||
|
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='starred_parts')
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='starred_parts')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ['part', 'user']
|
||||||
|
|
||||||
|
|
||||||
class BomItem(models.Model):
|
class BomItem(models.Model):
|
||||||
""" A BomItem links a part to its component items.
|
""" A BomItem links a part to its component items.
|
||||||
|
Loading…
Reference in New Issue
Block a user