[Answered ]-How can I prevent row duplicates in Django when no field is unique?

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',)

Leave a comment