diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index ab4c094c1c..7ea2fd59aa 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -2248,7 +2248,7 @@ class NullBooleanField(BooleanField): "NullBooleanField is removed except for support in historical " "migrations." ), - "hint": "Use BooleanField(null=True) instead.", + "hint": "Use BooleanField(null=True, blank=True) instead.", "id": "fields.E903", } diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index 50430ec1be..789a65efaa 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -821,7 +821,7 @@ Miscellaneous :class:`~django.db.models.expressions.RawSQL` instead beforehand. * The ``NullBooleanField`` model field is deprecated in favor of - ``BooleanField(null=True)``. + ``BooleanField(null=True, blank=True)``. * ``django.conf.urls.url()`` alias of :func:`django.urls.re_path` is deprecated. diff --git a/tests/invalid_models_tests/test_deprecated_fields.py b/tests/invalid_models_tests/test_deprecated_fields.py index 7b1e3fb7ac..429e15febc 100644 --- a/tests/invalid_models_tests/test_deprecated_fields.py +++ b/tests/invalid_models_tests/test_deprecated_fields.py @@ -59,7 +59,7 @@ class DeprecatedFieldsTests(SimpleTestCase): checks.Error( "NullBooleanField is removed except for support in historical " "migrations.", - hint="Use BooleanField(null=True) instead.", + hint="Use BooleanField(null=True, blank=True) instead.", obj=NullBooleanFieldModel._meta.get_field("nb"), id="fields.E903", ),