1
0
mirror of https://github.com/django/django.git synced 2025-01-19 14:52:54 +00:00

Refs #25467 -- Added test for excluding one-to-one relation with unsaved objects.

Fixed in 58da81a5a372a69f0bac801c412b57f3cce5f188.
This commit is contained in:
Jacob Walls 2021-10-02 14:43:03 -04:00 committed by Mariusz Felisiak
parent e17ab0af91
commit 28f66b2783

View File

@ -2846,6 +2846,14 @@ class ExcludeTests(TestCase):
[self.j1, self.j2],
)
def test_exclude_unsaved_o2o_object(self):
jack = Staff.objects.create(name='jack')
jack_staff = StaffUser.objects.create(staff=jack)
unsaved_object = Staff(name='jane')
self.assertIsNone(unsaved_object.pk)
self.assertSequenceEqual(StaffUser.objects.exclude(staff=unsaved_object), [jack_staff])
class ExcludeTest17600(TestCase):
"""