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

Fix prepare_lookup_value to handle '0' for _isnull #982

Closed
wants to merge 20 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@benjiec

benjiec commented Apr 2, 2013

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.

@benjiec

This comment has been minimized.

Show comment
Hide comment
@benjiec

benjiec Apr 3, 2013

Closing this pull request to open a new one.

benjiec commented Apr 3, 2013

Closing this pull request to open a new one.

@benjiec benjiec closed this Apr 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment