from django.db import models class Config(models.Model): indice = models.CharField(max_length=32,null=False) valore = models.CharField(max_length=128,null=True) nota = models.CharField(max_length=256,null=True) def __str__(self): return f"{self.id}: {self.nome}" class Meta: constraints = [ models.UniqueConstraint(fields=['indice'], name="unique-indice") ] indexes = [ models.Index(fields=['indice']) ]