How do I ensure that a unique combination of two properties should not be repeated
For instance in the following model
class modelBodyPart(models.Model):
area = models.CharField(max_length=128)
crush_name = models.CharField(max_length=128)
In each instance of modelBodyPart area
and crush_name
should always be different
for example some allowed and non-allowed results are:
area = Area_A crush_name=Jenny //OK
area = Area_A crush_name=Jordan //OK
area = Area_B crush_name=Jenny //OK
area = Area_A crush_name=Jenny //Not allowed
How would I implement this in the model ? Will I use unique_together I could not totally understand the case requirement from the above link that is why I am asking here.