Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascading quereyset deletes don't go through treebeard and result in a corrupted tree. #319

Open
jxcl opened this issue May 6, 2015 · 0 comments

Comments

@jxcl
Copy link
Contributor

jxcl commented May 6, 2015

Steps to reproduce:

>>> from mysite.widgy_site import *
>>> from widgy.contrib.page_builder.models import Figure, Html
>>> f = Figure.add_root(site)
>>> h = f.add_child(site, Html)
>>> h.node.id
2
# This deletes the figure and django knows to cascade delete its node. However,
# it does not delete the node using treebeard's custom queryset that manages
# tree consistency. The SQL issued is just `DELETE FROM widgy_node WHERE id =
#1`, which leaves the Html's node orphaned
>>> Figure.objects.filter(pk=f.pk).delete()
>>> Node.find_problems()
# The Html node is orphaned.
([], [], [2], [], [])

Expected:

All deletes should use the treebeard queryset.

Observed:

Cascading querysets use the django builtin queryset and result in a corrupted tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant