diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-03-09 11:18:11 -0400 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-05-09 13:01:04 +0100 |
| commit | 69ab6e5896ff1a6d9e7ab8a28e75c28d3d7d65f4 (patch) | |
| tree | 7c498fd4e7e475f1e814ca823159b5a96f3b0cd4 /tests/foreign_object/tests.py | |
| parent | f5197be818dfcb0d58d6e5f7cc44ec5343010b58 (diff) | |
Fixed #36207 -- Cleared cached ForeignObject relations via refresh_from_db().
Diffstat (limited to 'tests/foreign_object/tests.py')
| -rw-r--r-- | tests/foreign_object/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index 7670330995..696dfcd5fd 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -450,6 +450,15 @@ class MultiColumnFKTests(TestCase): normal_groups_lists = [list(p.groups.all()) for p in Person.objects.all()] self.assertEqual(groups_lists, normal_groups_lists) + def test_refresh_foreign_object(self): + member = Membership.objects.create( + membership_country=self.usa, person=self.bob, group=self.cia + ) + member.person = self.jim + with self.assertNumQueries(1): + member.refresh_from_db() + self.assertEqual(member.person, self.bob) + @translation.override("fi") def test_translations(self): a1 = Article.objects.create(pub_date=datetime.date.today()) |
