You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Treebeard's MP_NodeQuerySet has a delete() method that handles deleting children and updating numchild counts in their parents. However, if delete() is called on a content, django's collector does try to delete that content's node (through GenericRelation), but it doesn't use treebeard's custom delete. This means that there is a hole in the tree, where a generation is skipped. This totally breaks prefetch_tree.
A failing test:
diff --git a/tests/modeltests/core_tests/tests/core.py b/tests/modeltests/core_tests/tests/core.py
index c15c586..fca14e6 100644
--- a/tests/modeltests/core_tests/tests/core.py+++ b/tests/modeltests/core_tests/tests/core.py@@ -260,6 +260,12 @@ class TestCore(RootNodeTestCase):
self.assertEqual(widget.get_attributes(),
attributes)
+ def test_delete_queryset(self):+ Layout.objects.all().delete()+ self.assertFalse(Layout.objects.all().exists())+ # deleting the content should also delete the node's children+ self.assertFalse(Node.objects.all().exists())+
class TestRegistry(RootNodeTestCase):
def setUp(self):
The text was updated successfully, but these errors were encountered:
Treebeard's MP_NodeQuerySet has a delete() method that handles deleting children and updating numchild counts in their parents. However, if delete() is called on a content, django's collector does try to delete that content's node (through GenericRelation), but it doesn't use treebeard's custom delete. This means that there is a hole in the tree, where a generation is skipped. This totally breaks prefetch_tree.
A failing test:
The text was updated successfully, but these errors were encountered: