I\'ve been getting the most weird error ever. I have a Person model
class Person(models.Model):
user = models.OneToOneField(User, primary_key=True)
f
In Django 1.11, form CharFields
will have an empty_value argument, which allows you to use None
if the field is empty.
Model forms, including the Django admin, will automatically set empty_value=None if the model's CharField
has null=True
.
Therefore, you will be able to use null=True
, blank=True
and unique=True
together in your model CharField
without the unique constraint causing problems.