1. Gustavo Picon
  2. django-treebeard
Issue #38 invalid

Problems on delete child nodes

rgcarrasqueira
created an issue

Hi!

I'm using your django-treebeard app to work with trees on my application. So I've detected when I work with a tree with many leafs and branchs and I need to delete an entire branch, I run the method .delete() but I perceived that the data existent inside database is not being removed from there. So If I need to put a new branch at the same old place, an error appear at the system:

IntegrityError at /salesflow/json/site/manage/

(1062, "Duplicate entry '0001000100010001' for key 'path'")

Trying to insert after root > node 1 > node 2

Can you give a clue how to solve this?

Thanks

Rogério Carrasqueira

Comments (4)

  1. Gustavo Picon repo owner

    Rogerio,

    Please confirm that you are aware of the warning in https://tabo.pe/projects/django-treebeard/docs/tip/api.html that says:

    Warning Please note that django-treebeard uses Django
    raw SQL queries for some write operations, and raw
    queries don’t update the objects in the ORM since it’s
    being bypassed.
    
    Because of this, if you have a node in memory and plan
    to use it after a tree modification (adding/removing/moving nodes),
    you need to reload it.
    

    If you are aware of this and your code is correct, then please send me sample data or a test case so I can replicate the problem.

  2. Anonymous

    Hi Gustavo,

    This problem does not happens when I use the tree on AL Mode. But on MP Mode, I have to reload the tree and fix problems to make the full operation.

    Thanks

  3. Log in to comment