skillfed

django-modeltree

TODO

django-modeltree v1.0.0 85.7K downloads/30d#13,905 on PyPI3
Permissive license BSD License AGING released

What it is and what it does

django-modeltree is a Django utility that simplifies navigation of model relationships by building a tree structure from your model layout. Instead of writing complex queries to traverse related models, you define the tree once and access related objects and their data through an elegant interface. It wraps Django's ORM and anytree to provide a more intuitive way to work with interconnected models.

The package targets developers working with Django projects that have intricate model relationships. It aims to reduce boilerplate query code and make relationship traversal more readable. With support for Django 2.2 through 6.0 and Python 3.7 through 3.13, it covers a wide range of modern Django deployments, though the aging maintenance status and low adoption suggest it may not receive timely updates for new Django releases.

Use it for:

  • Navigate multi-level model relationships in a Django admin or API without writing nested select_related or prefetch_related chains.
  • Build a tree representation of a hierarchical model structure (e.g., organizational units, category taxonomies) for efficient traversal.
  • Simplify access to related objects when building reports or exports that require data from multiple connected models.
  • Reduce ORM query complexity in views or serializers that need to fetch and display related model data.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a simplified interface for navigating Django model relationships and accessing related objects without complex query building.

Yes, if your Django project has complex model relationships and you want to reduce query boilerplate—the low install friction and permissive license make it a low-risk addition. However, the aging maintenance status (last commit 2026-01-29, only 3 stars) suggests limited community support; verify that it meets your specific use case and that you're comfortable with potential delays in Django version compatibility updates.

Install

django-modeltree on PyPI

pip

pip install django-modeltree

uv

uv add django-modeltree

poetry

poetry add django-modeltree

Installing django-modeltree

Before you install

Low install friction with a pure-Python wheel. Maintenance status is aging—last commit was 2026-01-29 and the package has only 3 GitHub stars, suggesting limited community adoption and potential for delayed updates.

License in practice

BSD License (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install django-modeltree

from django_modeltree import ModelTree

# Build a modeltree to navigate model relationships
tree = ModelTree(YourModel)

Requires Django and anytree as runtime dependencies; Django version support spans 2.2 through 6.0.

Verify before relying

  • Whether the package handles circular relationships or complex many-to-many scenarios without performance degradation.
  • Specific performance characteristics compared to standard Django ORM queries for large model hierarchies.
  • Whether the package is actively maintained or if the aging status indicates it may not support future Django versions.

Package facts

License BSD License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — Django, anytree
Maintenance aging — 211 days since the last release
Last repo commit
First released
Downloads 85,686/month — #13,905 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_modeltree-1.0.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Framework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Application Frameworks

Tags

django model relationships navigationdjango model tree traversaldjango related objects accessdjango query simplificationdjango model hierarchydjango orm relationship helperdjango model graph navigation
django-ormmodel-relationships

More Software Development packages

typing-extensions

Provides backported and experimental type hints…

permissive · top 100 on PyPI

numpy

NumPy provides an N-dimensional array object…

permissive · top 100 on PyPI

fastapi

FastAPI is a Python web framework for building…

permissive · top 100 on PyPI

annotated-doc

Provides a way to document function parameters,…

permissive · top 100 on PyPI

typer

Typer builds command-line applications from…

permissive · top 1,000 on PyPI

distlib

Distlib provides low-level packaging utilities…

permissive · top 1,000 on PyPI

nutree

Nutree provides a Python library for creating,…

permissive · top 5,000 on PyPI

django-reverse-admin

Adds reverse inline support to Django admin for…

permissive · top 15,000 on PyPI

django-peeringdb

Provides Django ORM models and admin interface…

permissive · top 15,000 on PyPI

django-diagram

Generates Entity Relationship Diagrams in…

unclear · top 15,000 on PyPI

django-click

Wraps the click command-line library to let you…

permissive · top 15,000 on PyPI

simple-icd-10-cm

Provides Python functions to validate,…

permissive · top 15,000 on PyPI

django-nonrelated-inlines

Provides Django admin inline classes that let…

permissive · top 15,000 on PyPI

drf-writable-nested

Extends Django REST Framework serializers to…

permissive · top 15,000 on PyPI

rest-framework-generic-relations

Provides Django REST Framework serializers that…

permissive · top 15,000 on PyPI

django-countries

Provides a Django model field for storing…

permissive · top 5,000 on PyPI