Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 851
Martin Thoma Avatar asked Aug 10 '26 10:08

Martin Thoma


1 Answers

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.

like image 120
djvg Avatar answered Aug 11 '26 22:08

djvg