#9177: list_filter cannot filter nullable fields
----------------------------------+-----------------------------------------
 Reporter:  bthomas               |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  django.contrib.admin  |     Version:  1.0       
 Keywords:                        |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9177>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to