A Closure based Tree model for Django.
Django closure tree model.
Abstract base model for creating a Closure Tree using a recursive Postgres view.
Inherit from the Node model:
from closure_tree.models import Node class MyNode(Node): name = models.CharField(max_length=30)
$ ./manage.py makemigrations
Add the CreateTreeClosure migration step:
$ ./manage.py makenigrations --empty myapp
from closure_tree.migrations import CreateTreeClosure class Migration(migrations.Migration): dependencies = [ ('dummy', '0001_initial'), ] operations = [ CreateTreeClosure('MyNode'), ]
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for closure_tree-0.1.0-py2.py3-none-any.whl