In my model:
class MyModel(models.Model):
active = models.BooleanField()
path = models.CharField(max_length = 512)
I would like to constrain that the 'path' attribute is unique amongst instances where active is True.
It seems like overriding save() might not work, as if two saves are done concurrently, both might pass the test and go ahead and save. Is there some trick or custom SQL (I'm using MySQL) I could use to have a conditional uniqness constraint like this at the database level?