Tree structure for hierarchical data
Project description
Django Tree
Overview
A tree structure for hierarchical data. Optimised for fast insertion/moving of nodes around the tree.
Requirements
- Django 3.2+
- Python 3.8+
Installation
- Add
django_treetoINSTALLED_APPS.
Usage
Simply extend the BaseTreeNode class in your application: e.g.
from django.db import models
from django_tree.models import BaseTreeNode
class Category(BaseTreeNode):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
# Will contain an OrderedDict of categories organised into a tree structure.
categories = Category.objects.build_tree()
Testing
- Install dev dependencies:
poetry install. - Install a supported version of Django:
pip install django==3.2 - Run the tests:
DB_NAME="django_tree" python -m pytest tests .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-orderable-tree-0.1.0.tar.gz.
File metadata
- Download URL: django-orderable-tree-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b308fd5ff9af4fdc6f8d2687f0843d4d0de2507e615983467c324301424cc1f
|
|
| MD5 |
54212844d4d7fde0d0b615d4c41d69e1
|
|
| BLAKE2b-256 |
14d227e7713ad1bad03ef66060ec9445ddfdd162f54f13d20fbd074d9d347f14
|
File details
Details for the file django_orderable_tree-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_orderable_tree-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cabb36a6b037de542f6d91094330ee7d6c41686d9288f943470e06969579e71d
|
|
| MD5 |
71ae6c2fb6163de83d1d71d170776285
|
|
| BLAKE2b-256 |
bd7b12bbe3424eff97a3dc0eacc31b0286b034a287653124667a6c80dc7ec1b7
|