Hello,
I have the following class:
==================================
class Silo(models.Model):
nave = models.ForeignKey(Nave, on_delete=models.CASCADE)
codSil = models.CharField(
'Código Silo', db_index=True, max_length=2, default='01')
notas = models.TextField(null=True, blank=True)
def __str__(self):
return "%s %s" % (self.nave, self.codSil)
class Meta:
order_with_respect_to = 'nave'
unique_together = ('nave', 'codSil')
====================================
But the option unique_together does not work because duplicate values exist in the SQLite database for nave and codSil.
To solve it, I have to create the index nave + codSil by hand in the SQLite database ???
Thank you