store null as default value againt Null boolean field

django, python, sqlite

Solution

An empty string `""` is not `None`

>>> "" is None
False

If you want the default to be `None` then write:

employed = models.NullBooleanField(choices=LOCATOR_YES_NO_CHOICES,
                                max_length=3,
                                blank=True, null=True, default=None,)

Problem

How to use `NullBooleanField` in `Django` models with `SQLlite3`, I want to store `null` as default value for the `nullBoolean` field, how do I do that? I have migrated db from `BooleanField` to `NullBooleanField`, but it is still storing False as the default value. Usage in the code is as: ``` LOCATOR_YES_NO_CHOICES = ((None,''), (True,'Yes'), (False, 'No')) employed = models.NullBooleanField(choices=LOCATOR_YES_NO_CHOICES, max_length=3, blank=True, null=True, default="",) ``` Any example would be of great help.

Original source