# django-treebeard/django-treebeard

Efficient tree implementations for Django

Repository: https://github.com/django-treebeard/django-treebeard
Canonical: https://ross.abutalabs.com/products/django-treebeard
Homepage: http://django-treebeard.readthedocs.io/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: django, tree-structure, python
Last push: 2026-08-20T07:58:46+00:00

## Health v2 (maintenance only)
Score: 76/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 35, longevity 100
- inputs: {"age_days": 5990, "days_push": 13, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1218, forks 221 (observed 2026-08-28T04:04:01.590993+00:00)

## What it is
django-treebeard is a Python library providing efficient tree data structure implementations for Django models. It offers multiple tree algorithms (adjacency list, materialized path, nested sets, and PostgreSQL ltree) behind a single consistent API via abstract model classes.

## Use cases
- store hierarchical categories in Django
- model nested comments with parent-child relationships
- manage organizational charts in a Django app
- query subtrees and descendants efficiently
- implement menu or taxonomy trees in Django
- migrate between different tree storage strategies

## When to choose
- you use Django and need hierarchical data with fast tree operations
- you want a well-tested library with multiple tree implementations and a shared API
- you need PostgreSQL ltree support or broad database backend compatibility

## When to avoid
- you are not using Django or an ORM with Django-style models
- you only need shallow one-level parent-child relations without tree queries
- you need graph (many-to-many) rather than tree structures

## Facets
- artifact type: library
- maturity: stable
- function: orm, database
- domain: web-development, databases, backend
- platform: python, cross-platform
- tags: django, tree-structure, hierarchical-data, adjacency-list, nested-sets, materialized-path, ltree

## Member repositories
- django-treebeard/django-treebeard (main) score 76

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:01.590993+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:17:03.760019+00:00, confidence not recorded.
  - readme: https://github.com/django-treebeard/django-treebeard (fetched 2026-08-28T04:04:01.590993+00:00, sha 0cebd36deba6)
  - registry_pypi: https://pypi.org/pypi/django-treebeard/json (fetched 2026-08-29T12:25:20.981085+00:00, sha 2f94c4ba2a53)
- Data as of 2026-08-30T08:39:29.467469+00:00.
