From 175b6d93dcfd229eaa20a2a5e6138667fde135e0 Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Sun, 1 Dec 2024 19:46:04 -0300 Subject: [PATCH] changed constrain on model --- action/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action/models.py b/action/models.py index c6dc47f..0bf43dc 100644 --- a/action/models.py +++ b/action/models.py @@ -27,7 +27,9 @@ class StateDefinition(models.Model): state = models.CharField(max_length=50) class Meta: - unique_together = ('institution', 'state') + constraints = [ + models.UniqueConstraint(fields=['institution', 'state'], name='unique_institution_state') + ] def __str__(self): return f"{self.institution.name} - {self.state}"