caktus / django-treenav

Extensible, hierarchical, and pluggable navigation system for Django sites
BSD 3-Clause "New" or "Revised" License
130 stars 34 forks source link

Delete from Admin changelist fails #54

Closed benred42 closed 9 years ago

benred42 commented 9 years ago

Attempting to delete an item from the admin's changelist fails because it uses treenav's MenuItemManager instead of MPTT's TreeManager. Deleting from the admin's change form, however, does work.

benred42 commented 9 years ago

Copied from kkellydesign's comment on issue #42 :

benred42 commented 9 years ago

So, making MenuItemManager inherit from TreeManager instead of models.Manager fixes this bug, but will doing that likely cause other issues?

mlavin commented 9 years ago

I looks like MPTT 0.4 -> 0.5 made this change https://github.com/django-mptt/django-mptt/blob/master/docs/upgrade.rst#042-to-055 It looks like MPTT expects .objects to be a TreeManager and I'm surprised we aren't seeing more problems with the current behavior. I think we should move forward with this change. There is a conflict in that both try to override get_queryset and that will need be resolved.

benred42 commented 9 years ago

It looks like it should be possible to replicate the principle behavior of the TreeManager get_queryset method in our MenuItemManager. All it's really doing is ordering the queryset.