1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #15579 -- Added ability to delete only child models in multi-table inheritance.

This commit is contained in:
Andriy Sokolovskiy
2015-02-07 01:16:26 +02:00
committed by Tim Graham
parent b9cb81570e
commit 81c2d9f60b
5 changed files with 41 additions and 18 deletions

View File

@@ -349,6 +349,13 @@ class DeletionTests(TestCase):
self.assertFalse(S.objects.exists())
self.assertFalse(T.objects.exists())
def test_delete_with_keeping_parents(self):
child = RChild.objects.create()
parent_id = child.r_ptr_id
child.delete(keep_parents=True)
self.assertFalse(RChild.objects.filter(id=child.id).exists())
self.assertTrue(R.objects.filter(id=parent_id).exists())
class FastDeleteTests(TestCase):