1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

Fixed #35614 -- Prevented SQLCompiler.as_subquery_condition() from mutating a query.

This commit is contained in:
Bendeguz Csirmaz
2024-07-18 18:33:09 +08:00
committed by Sarah Boyce
parent b21f6d7ee4
commit bdd538488c
2 changed files with 12 additions and 4 deletions

View File

@@ -223,6 +223,13 @@ class MultiColumnFKTests(TestCase):
[m2],
)
def test_query_does_not_mutate(self):
"""
Recompiling the same subquery doesn't mutate it.
"""
queryset = Friendship.objects.filter(to_friend__in=Person.objects.all())
self.assertEqual(str(queryset.query), str(queryset.query))
def test_select_related_foreignkey_forward_works(self):
Membership.objects.create(
membership_country=self.usa, person=self.bob, group=self.cia