mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Refs #31369 -- Deprecated models.NullBooleanField in favor of BooleanField(null=True).
This commit is contained in:
parent
34a69c2458
commit
a92cc84b4a
7 changed files with 37 additions and 2 deletions
|
@ -37,3 +37,18 @@ class DeprecatedFieldsTests(SimpleTestCase):
|
|||
id='fields.E901',
|
||||
)],
|
||||
)
|
||||
|
||||
def test_nullbooleanfield_deprecated(self):
|
||||
class NullBooleanFieldModel(models.Model):
|
||||
nb = models.NullBooleanField()
|
||||
|
||||
model = NullBooleanFieldModel()
|
||||
self.assertEqual(model.check(), [
|
||||
checks.Warning(
|
||||
'NullBooleanField is deprecated. Support for it (except in '
|
||||
'historical migrations) will be removed in Django 4.0.',
|
||||
hint='Use BooleanField(null=True) instead.',
|
||||
obj=NullBooleanFieldModel._meta.get_field('nb'),
|
||||
id='fields.W903',
|
||||
),
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue