If have the following Django (1.4) model:
from django.db import models
class SimpleModel(models.Model):
name = models.CharField(max_length=100)
Django never stores NULL for empty CharField
or TextField
types. It stores an empty string (''
). So that's why you don't get an IntegrityError
for null=False
.
As for blank=False
, that only affects forms. It just makes the form set the field as required=True
so it won't validate unless it has a value. It doesn't affect the database or your ability to manually set a blank value outside of a form.