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 makemigrations --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

django-closure-tree-0.2.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

django_closure_tree-0.2.1-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-closure-tree-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-closure-tree-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bd29fb181c6636bd4575cc159557372818225f12f7a4f9b95a63a3b64d1e3c55
MD5 2ed5b2c85eec0fd28ef2ae8ed952b472
BLAKE2b-256 d27446e92fde744242491cb893aed7e7311c3271007be679b18742678b9a1ef8

See more details on using hashes here.

Provenance

File details

Details for the file django_closure_tree-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_closure_tree-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 54e23303d4febac79955de959569c974c20ed5649af7c7b27e990f878b1147cc
MD5 5763f1572a3c239e5d2a5bd1367e5802
BLAKE2b-256 9d95978666be323991b5873635c106a4ed45d26c1fb8de2365a5665173e3377b

See more details on using hashes here.

Provenance

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