Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of django-treebeard over django-mptt?

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?

like image 261
Aidas Bendoraitis Avatar asked Oct 20 '15 11:10

Aidas Bendoraitis


1 Answers

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.

side note for Postgres users

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).

like image 134
Jacob Fredericksen Avatar answered Sep 28 '22 03:09

Jacob Fredericksen