1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

[6.0.x] Fixed #36264 -- Excluded proxy neighbors of parents from deletion collection when keep_parents=True.

Signed-off-by: saJaeHyukc <wogur981208@gmail.com>

Backport of 748551fea0 from main.
This commit is contained in:
saJaeHyukc
2025-09-02 14:16:30 +09:00
committed by Sarah Boyce
parent fd94c90526
commit e0f328d790
3 changed files with 19 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ from .models import (
RChild,
RChildChild,
Referrer,
RProxy,
S,
T,
User,
@@ -675,6 +676,14 @@ class DeletionTests(TestCase):
)
signal.disconnect(receiver, sender=Referrer)
def test_keep_parents_does_not_delete_proxy_related(self):
r_child = RChild.objects.create()
r_proxy = RProxy.objects.get(pk=r_child.pk)
Origin.objects.create(r_proxy=r_proxy)
self.assertEqual(Origin.objects.count(), 1)
r_child.delete(keep_parents=True)
self.assertEqual(Origin.objects.count(), 1)
class FastDeleteTests(TestCase):
def test_fast_delete_all(self):