Django CharField without empty strings
Use a MinLengthValidator
:
from django.core.validators import MinLengthValidator
...
title = models.CharField(max_length=10, validators=[MinLengthValidator(1)])
According to the documentation, blank=False
is purely validation-related that works only on a form level.
See related threads:
- Django model blank=False does not work?
- Why are blank and null distinct options for a django model?