From 35743e8be91fd559ca798966a6323df3e0485784 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 27 Nov 2023 22:47:56 +0100 Subject: [PATCH] fixed constraint --- cookbook/migrations/0203_alter_unique_contstraints.py | 2 +- cookbook/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/migrations/0203_alter_unique_contstraints.py b/cookbook/migrations/0203_alter_unique_contstraints.py index 7dc6cc08c4..f4d0af3334 100644 --- a/cookbook/migrations/0203_alter_unique_contstraints.py +++ b/cookbook/migrations/0203_alter_unique_contstraints.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.AddConstraint( model_name='mealtype', - constraint=models.UniqueConstraint(fields=('space', 'name'), name='mt_unique_name_per_space'), + constraint=models.UniqueConstraint(fields=('space', 'name', 'created_by'), name='mt_unique_name_per_space'), ), ] diff --git a/cookbook/models.py b/cookbook/models.py index 66a4534d3c..6ea39d2e4d 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -985,7 +985,7 @@ def __str__(self): class Meta: constraints = [ - models.UniqueConstraint(fields=['space', 'name'], name='mt_unique_name_per_space'), + models.UniqueConstraint(fields=['space', 'name', 'created_by'], name='mt_unique_name_per_space'), ]