Skip to content
Closure view based Tree models for Django
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
closure_tree Override RunSQL less. Feb 17, 2018
.gitignore Update gitignore Nov 3, 2017
LICENSE Initial commit Oct 20, 2017
README.rst
setup.py Rename to django-closure-tree Oct 22, 2017

README.rst

Django closure tree model.

Abstract base model for creating a Closure Tree using a recursive Postgres view.

https://schinckel.net/2016/01/28/django-trees-via-closure-view/

Usage

Inherit from the Node model:

from closure_tree.models import Node


class MyNode(Node):
    name = models.CharField(max_length=30)

Create migrations:

$ ./manage.py makemigrations

Add the CreateTreeClosure migration step:

$ ./manage.py makemigrations --empty myapp
from closure_tree.migrations import CreateTreeClosure

class Migration(migrations.Migration):

    dependencies = [
        ('dummy', '0001_initial'),
    ]

    operations = [
        CreateTreeClosure('MyNode'),
    ]
You can’t perform that action at this time.