mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #15579 -- Added ability to delete only child models in multi-table inheritance.
This commit is contained in:
parent
b9cb81570e
commit
81c2d9f60b
5 changed files with 41 additions and 18 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue