NullBooleanField
s aren't completely supported by django-filter. By default, any generated fields will default to BooleanFilter
, which only supports filtering by yes/no values, but not by null values. As documented in https://github.com/carltongibson/django-filter/issues/522#issuecomment-258171253, this is now solvable in userland, but support could still be improved in-package.
Shall take into account BooleanField(null=True)
as well.
Thanks. Like you mentioned on SO - NullBooleanField
will likely be deprecated at some point, so the solution here would need to account for both NullBooleanField
and BooleanField
s w/ null=True
.
I have noticed that it was supported in django filter 1.x version by using 1, 2, 3 for null, false, and true respectively. After upgrading to 2.0 it has been changed to true / false but it is not stated in the "Migrating to 2.0" doc.
Any reason for removing this feature?
It's also true that NullBooleanField
doesn't support true/false (though it supports True/False).
Most helpful comment
Shall take into account
BooleanField(null=True)
as well.