list_filter cannot filter nullable fields
|Reported by:||Bob Thomas||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a model with a FloatField that is nullable. I would like to filter models that have that field set to null, so I added it to list_filter in my ModelAdmin class. When I select the "None" option, I get an exception from get_db_prep_value because it's calling float(None). I tried modifying get_db_prep_value for FloatField to return None if value is None or "None", which got rid of the exception, but did not return any results.
Will attach a patch if I figure out how to fix this to return correct results.
ForeignKey fields that are nullable do not even display a None option in the filter, but I get a similar error trying to modify the query string to use None instead of an id.