changed constrain on model
This commit is contained in:
parent
22d4cea560
commit
175b6d93dc
|
@ -27,7 +27,9 @@ class StateDefinition(models.Model):
|
||||||
state = models.CharField(max_length=50)
|
state = models.CharField(max_length=50)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('institution', 'state')
|
constraints = [
|
||||||
|
models.UniqueConstraint(fields=['institution', 'state'], name='unique_institution_state')
|
||||||
|
]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.institution.name} - {self.state}"
|
return f"{self.institution.name} - {self.state}"
|
||||||
|
|
Loading…
Reference in a new issue