I have this model:
class Part(models.Model): serial_number = models.CharField(max_length=15, null=True, blank=True, validators=[validate_serial], unique=True) ....
serial_number can be empty and null because all parts do not necessarily have a serial number. However, after saving one part without the serial number, the empty string is no longer unique, and I get this error:
A part with this serial number already exists.
Is there a workaround for this? I have already addressed this issue , but I do not have a model. I either use the administrator or do it directly in the code.
python django
jdickson
source share