Pull request for issue 20182 - Parses string literal 0 as value False when key is __isnull #986

Closed
wants to merge 1 commit into from

2 participants

@benjiec benjiec Parses string literal 0 as value False when key is __isnull.
keep comments in sync with fix.
added tests for issue 20182
ab81433
@timgraham timgraham commented on the diff May 24, 2013
tests/admin_views/tests.py
+ self.assertTrue(m) # Got a match
+ popup_url = m.groups()[0].decode().replace("&", "&")
+
+ # Handle relative links
+ popup_url = urljoin(response.request['PATH_INFO'], popup_url)
+ # Get the popup and verify the correct objects show up in the resulting
+ # page. This step tests field__isnull=0 gets parsed correctly from the
+ # lookup query string; in model we define defendant0 field to have a
+ # limit_choices_to option that includes "actor__title__isnull=False".
+ response2 = self.client.get(popup_url)
+ self.assertContains(response2, "Kilbraken")
+ self.assertNotContains(response2, "Palin")
+
+ def test_limit_choices_to_isnull_true(self):
+ """Regression test for 20182"""
+ actor = Actor.objects.create(name="Palin", age=27)
@timgraham
Django member

"actor" variables are unused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@timgraham timgraham commented on the diff May 24, 2013
tests/admin_views/tests.py
response2 = self.client.get(popup_url)
self.assertContains(response2, "Spain")
self.assertNotContains(response2, "England")
+ def test_limit_choices_to_isnull_false(self):
+ """Regression test for 20182"""
+ actor = Actor.objects.create(name="Palin", age=27)
@timgraham
Django member

"actor" variables are unused

@timgraham
Django member

Should be able to fix it when committing, just making a note of it. Thanks for the patch; I happen onto the problem from time to time as well. :-)

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

Merged in 0268aba -- thank-you!

@timgraham timgraham closed this May 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment