0👍
✅
You need to add it as
indexes.CharField(model_attr='company', null=True)
and if you want to allow the blank then
add blank=True
indexes.CharField(model_attr='company', blank=True, null=True)
1👍
It seems that you have some entries in your database where a mandatory field is left empty. This can be caused by adding a new mandatory field to an existing model so that existing instances of the model are invalidated due to the empty field.
If you want to enforce the field to have a value, you need to give the existing instances a value for the field. If you use the migration tool south it will give you an interactive prompt to fix the problem. Check out the “Data Migration” section of the south documentation.
If it is okay for you to leave the field optional, set blank=True
(allows leaving the field blank) and null=True
(sets NULL for empty field).
- Django form with ModelChoiceField is always invalid
- Creating a header image with bootstrap
- Django: Query which excludes all children if the parent is included in the query
Source:stackexchange.com