Skip to content

Fix prepare_lookup_value to handle '0' for _isnull #982

Closed
wants to merge 20 commits into from

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 and others added some commits Apr 2, 2013
@benjiec benjiec Parses string literal 0 as value False when key is __isnull 8cb3368
@benjiec benjiec Parses string literal 0 as value False when key is __isnull.
keep comments in sync with fix.
2661b55
@benjiec benjiec Merge branch 'master' of github.com:benjiec/django 9454978
Preston Timmons Move last remaining tests out of models.py files; prep for test disco…
…very.
8ce4637
Preston Timmons Modified admindocs tests to work with unittest2 discovery. 7fd1571
Preston Timmons Updated flatpages tests for unittest2 discovery. 8aedde0
Preston Timmons Modified formtools to work with unittest2 discovery. 756a70b
Preston Timmons Modified messages to work with unittest2 discovery. 629d704
Preston Timmons Modified sitemaps to work with unittest2 discovery. e3cfbaa
Preston Timmons Modified auth to work with unittest2 discovery. fde2e4f
@apollo13 apollo13 Adjusted download_url in setup.py c8deaa9
@benjiec benjiec added tests for issue 20182 5e5834f
@benjiec benjiec Parses string literal 0 as value False when key is __isnull.
keep comments in sync with fix.
added tests for issue 20182
df062ce
@benjiec benjiec Merge branch 'master' of github.com:benjiec/django c92d00f
@benjiec benjiec clarify tests and add another case to test is_null=True c57e31f
@benjiec benjiec clarify tests 3ba2258
@benjiec benjiec Parses string literal 0 as value False when key is __isnull.
keep comments in sync with fix.
added tests for issue 20182
5e0e156
@benjiec benjiec git pushMerge branch 'master' of github.com:benjiec/django 07fe5a3
@benjiec benjiec Parses string literal 0 as value False when key is __isnull.
keep comments in sync with fix.
added tests for issue 20182
8a2d9e7
@benjiec benjiec Merge branch 'master' of github.com:benjiec/django ad39c5d
@benjiec
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
Something went wrong with that request. Please try again.