django/django — pull request #982 by benjiec (2013-04-02 19:35:57+00:00)
Title: Fix prepare_lookup_value to handle '0' for _isnull

In contrib.admin.util, there is a prepare_lookup_value function

In this function, there is a clause

if value.lower() in ('', 'false'):
value = False

I think it should be

if value.lower() in ('', 'false', '0'):
value = False

Note that in admin already converts a limit_choices_to={'a__isnull': False} to a__isnull=0 when formatting a query string for lookup on the remote model. Therefore, clearly it should also handle isnull=0 correctly. Currently the lookup popup box on remote model uses __isnull=0 and does not actually filter.