summaryrefslogtreecommitdiff
path: root/tests/many_to_one_null/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/many_to_one_null/tests.py')
-rw-r--r--tests/many_to_one_null/tests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/many_to_one_null/tests.py b/tests/many_to_one_null/tests.py
index 2463065c9d..a72b821f88 100644
--- a/tests/many_to_one_null/tests.py
+++ b/tests/many_to_one_null/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.test import TestCase
-from .models import Reporter, Article
+from .models import Article, Car, Driver, Reporter
class ManyToOneNullTests(TestCase):
@@ -105,3 +105,10 @@ class ManyToOneNullTests(TestCase):
with self.assertNumQueries(1):
r.article_set.clear()
self.assertEqual(r.article_set.count(), 0)
+
+ def test_related_null_to_field(self):
+ c1 = Car.objects.create()
+ d1 = Driver.objects.create()
+ self.assertIs(d1.car, None)
+ with self.assertNumQueries(0):
+ self.assertEqual(list(c1.drivers.all()), [])