Tengo un campo en la tabla de mi formulario que no debería recibir datos duplicados pero no sé cómo configurarlo ni dónde debería realizar dicha configuración.
model.py:
class Empleados(models.Model):
OPCIONES_GENERO_CHOICES = (
('M', 'Masculino'),
('F', 'Femenino'),
)
nombre = models.CharField(max_length=15)
apellidos = models.CharField(max_length=15)
ci = models.IntegerField()
genero = models.CharField(max_length=255, choices=OPCIONES_GENERO_CHOICES, blank=True, null=True)
cargo = models.CharField(max_length=15)
creado = models.DateTimeField(auto_now_add=True)
email = models.EmailField()
telefono = models.CharField(max_length=12)
documento = models.FileField(
upload_to="archivo/",
null=True,
blank=True
)
def __str__(self):
return '%s'% (self.nombre)
el campo es ci
, que es la cédula de identidad (id, dni, etc.)