Django Hierarchical Tree Data View

Export

The comparison sheet below compares django-mptt and django-treebeard, two Django applications that enable you to easily add support for hierarchical data store to your models. django-treebeard has the advantage of offering multiple tree storage strategies, all neatly abstracted from using the same API. However, I personally really prefer the approach taken by django-mptt with respect to the way it keeps track of a node's parent: by means of a standard ForeignKey. This is less fragile, and by its smart usage of Django signals django-mptt allows you to modify a node's parents from anywhere (including the admin interface) without having to resort to a custom API call.

My conclusion: if the Nested sets / Modified Preorder approach is applicable to your use case, I would opt for django-mptt .

django-mptt django-treebeard 2009-07-01 (SVN) 2009-06-14 (SVN) Supported tree types django-mptt django-treebeard Nested sets / MP Materialized path Adjacency list Project status django-mptt django-treebeard Last update (SVN) 2009-07-01 2009-06-14 Jan. 16, 2008 Nov. 20, 2008 Official release (Version) 0.2.1 1.1 Documentation Features django-mptt django-treebeard Admin friendly Reparenting Via signals, automatically Explicit API calls required Forms support (TreeNodeChoiceField, MoveNodeForm) Template tags Yes No FIx/recompute existing tree Implementation details django-mptt django-treebeard Parent is ForeignKey based (Only for AL) Model preparation mptt.register(MyModel) class MyModel(NS_Node) Basic API feeling my_instance.get_descendants() my_instance.get_descendants()

Author: dotsphinx Created at: July 1, 2009 Last change: July 1, 2009 Tags: django, sql

Comments

No comments.