Django-filter: Deficiencies in filtering for models.NullBooleanField

Created on 9 Dec 2018  路  5Comments  路  Source: carltongibson/django-filter

NullBooleanFields 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.

Most helpful comment

Shall take into account BooleanField(null=True) as well.

All 5 comments

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 BooleanFields 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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xtrinch picture xtrinch  路  4Comments

ses4j picture ses4j  路  4Comments

lalzada picture lalzada  路  3Comments

chromakey picture chromakey  路  5Comments

sassanh picture sassanh  路  4Comments