[Django]-Django model creation jointly unique fields

4👍

unique_together is what you want.

class DeviceProperty(Model):
    …
    class Meta:
        unique_together = ['device', 'name']

Leave a comment