Skip to main content

A Closure based Tree model for Django.

Project description

Django closure tree model.

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

http://schinckel.net/2016/01/27/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 makenigrations --empty myapp
from closure_tree.migrations import CreateTreeClosure

class Migration(migrations.Migration):

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

    operations = [
        CreateTreeClosure('MyNode'),
    ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

closure_tree-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

closure_tree-0.1.0-py2.py3-none-any.whl (5.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file closure_tree-0.1.0.tar.gz.

File metadata

File hashes

Hashes for closure_tree-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0eb9b6ca79e189b1d09b7fde87a13d74242a97e0637a6422d8c4e284d02e6955
MD5 6bbd8b4415029ac7ea0bd86800386020
BLAKE2b-256 94b960829e75507737adba3a4a7ceae5bc04db98432fd9f8bc3be865914d6de2

See more details on using hashes here.

File details

Details for the file closure_tree-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for closure_tree-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c614c9f0e6ae6778099b45e8e0e89bf37dfab0d5c71b501d5a5e4e02be9129bc
MD5 32392857cf31a280a7f985b2091d8971
BLAKE2b-256 0157f0f81902e7ba326f1fc7bb2cbcca388c17182a79823796bd76345eff5f5d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page