summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-08-02 17:27:45 +0200
committerClaude Paroz <claude@2xlibre.net>2016-08-04 16:05:21 +0200
commit272eccf7ff0ced609e5a5e3bb6b4a40e773e0e66 (patch)
tree59689e5a6fd7e68401097ecbfb3f214f7c2ad315 /tests
parent7bc5274f6faf9e5296688d4708de0272a758e3f0 (diff)
Fixed #26983 -- Fixed isnull filtering on ForeignKey with to_field
Thanks weidwonder for the report.
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index e40ab1fa58..fdfd1b5725 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2483,6 +2483,19 @@ class ToFieldTests(TestCase):
[node1]
)
+ def test_isnull_query(self):
+ apple = Food.objects.create(name="apple")
+ Eaten.objects.create(food=apple, meal="lunch")
+ Eaten.objects.create(meal="lunch")
+ self.assertQuerysetEqual(
+ Eaten.objects.filter(food__isnull=False),
+ ['<Eaten: apple at lunch>']
+ )
+ self.assertQuerysetEqual(
+ Eaten.objects.filter(food__isnull=True),
+ ['<Eaten: None at lunch>']
+ )
+
class ConditionalTests(BaseQuerysetTest):
"""Tests whose execution depend on different environment conditions like