9👍
I’m not sure why you think that’s a bug. If you don’t specify blank=True
, some kind of non-empty value is required. The empty string, by definition, is an empty value; so Django quite correctly displays an error telling you to supply an actual value.
You do need to specify blank=True
if you want the empty string to be allowed. But you don’t need to specify null=True
; indeed, as the docs show, you shouldn’t use that on CharFields.
1👍
It’s correct. default
, null
and blank
have different meanings.
null
allows NULL value on database https://docs.djangoproject.com/en/dev/ref/models/fields/#null
blank
allows blank value on the model https://docs.djangoproject.com/en/dev/ref/models/fields/#blank
Additionally, a ModelForm (used by admin) with blank=True
sets the required field as false, see https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#field-types
- [Django]-Distinct values with Q objects
- [Django]-Custom authentication with django?
- [Django]-Validation Error with Multiple File Uploads in Django via Ajax
- [Django]-Best approach to handle concurrency in Django for eauction toy-app
- [Django]-Django Humanize naturaltime templatetag only partly translating