pythondjangodjango-rest-frameworkdrf-spectacular

AttributeError: module 'rest_framework.serializers' has no attribute 'NullBooleanField'


After upgrading djangorestframework from djangorestframework==3.13.1 to djangorestframework==3.14.0 the code

from rest_framework.serializers import NullBooleanField

Throws

AttributeError: module 'rest_framework.serializers' has no attribute 'NullBooleanField'

Reading the release notes I don't see a deprecation. Where did it go?


Solution

  • For what it's worth, there's a deprecation warning in the previous version, which also suggests a fix:

    The NullBooleanField is deprecated and will be removed starting with 3.14. Instead use the BooleanField field and set allow_null=True which does the same thing.