1👍
✅
You can use unique_together
so:
class MyModel(models.Model):
field1 = models.CharField(max_length=10)
field2 = models.CharField(max_length=10)
class Meta:
unique_together = ('field1', 'field2',)
Source:stackexchange.com