Bulk create odd behaviour

28 views
Skip to first unread message

João Pedro

unread,
Sep 25, 2020, 12:28:15 PM9/25/20
to django-mptt-dev
Hello all,

I don't think I'm doing it right, but what I've understood is that in order to bulk_create a tree you first need to use build_tree_nodes.

So what I've done is a function that generates the tree structure as dict, pass it to build_tree_nodes and then call bulk_create on the result.

It "kinda" worked, because the nodes were created in the database but there was this strange behavior: deleting the parent node didn't delete the children. For instance the previous method I was doing (generating node by node -- so multiple queries) the relationship was kept. 

Does anyone faced this problem before?
Reply all
Reply to author
Forward
0 new messages