Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deficiencies in filtering for models.NullBooleanField #1012

Open
rpkilby opened this issue Dec 9, 2018 · 5 comments
Open

Deficiencies in filtering for models.NullBooleanField #1012

rpkilby opened this issue Dec 9, 2018 · 5 comments

Comments

@rpkilby
Copy link
Collaborator

rpkilby commented Dec 9, 2018

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 #522 (comment), this is now solvable in userland, but support could still be improved in-package.

@karlosss
Copy link

karlosss commented Dec 9, 2018

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

@rpkilby
Copy link
Collaborator Author

rpkilby commented Dec 9, 2018

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.

@alan404
Copy link

alan404 commented Dec 18, 2018

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.

@karlosss
Copy link

Any reason for removing this feature?

@ses4j
Copy link

ses4j commented Feb 11, 2019

It's also true that NullBooleanField doesn't support true/false (though it supports True/False).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants