There are two well known Django packages for creating tree structures: django-treebeard and django-mptt. Recently Django CMS started using django-treebeard instead of django-mptt. Wagtail CMS is also using django-treebeard.
What makes django-treebeard a more preferable choice than django-mptt?
Most importantly, django-mptt
is explicitly unmaintained:
https://github.com/django-mptt/django-mptt#this-project-is-currently-unmaintained
So, at this point, using django-mptt
carries the significant risk that you won't be able to use current versions of other packages (depended on by django-mptt) and will eventually run into problems that will require you to switch to a different package like django-treebeard
.
Incidentally, for Postgres users, there is another interesting alternative to mptt: ltree
(https://www.postgresql.org/docs/current/ltree.html).
Currently (at the time I'm writing this), there's no maintained package for integrating ltree
with Django. However, django-treebeard has an open issue for adding ltree support: https://github.com/django-treebeard/django-treebeard/issues/170
In the meantime, it's easy enough to implement without a package. Here's a demo I found: https://github.com/peopledoc/django-ltree-demo. I can confirm that this demo still works well (even though the code is a few years old).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With