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.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

django_closure_tree-0.2.2-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.2.tar.gz.

File metadata

File hashes

Hashes for django-closure-tree-0.2.2.tar.gz
Algorithm Hash digest
SHA256 da644183a371eeefcb8a52e01353c0899daaf66206ef162505b01683f9a145a0
MD5 3835e730fcbc8c79cd270438bcad9b64
BLAKE2b-256 d9587aa3d1592666e733e9096dde4d0ce5157fbfbd618743b131d9139f58f027

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for django_closure_tree-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e26b7ee7ffa4d6dc6d6e583511973ed14a5a8bab83960dcaa0d92d4787b6d93a
MD5 fdc2a4f9cdb71a7eb8597039dd13f453
BLAKE2b-256 1e429ec5759cf9578e9f6497d4b0811b1c1b37972012f052aa0cef18c8a91f98

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