Deprecated NullBooleanField

NullBooleanField is deprecated and will be removed a future version of Django.

NullBooleanField is like BooleanField with null=True.

Historically the only values BooleanField accepted was True and False. BooleanField didn't permit null=True. If null was a valid value then NullBooleanField was used instead.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

django-doctorbotsuggested changes just now
models.py
1
+
class CommentModel(models.Model):
2
+
    is_active = models.NullBooleanField()

NullBooleanField is deprecated and will be removed a future version of Django.

Read more
Suggested changes
-
    is_active = models.NullBooleanField()
+
    is_active = models.BooleanField(null=True)
Commit suggestion
3
+
    body = models.TextField()
Update models.py

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.