Skip to main content

Django app to support ltree postgres extension

Project description


A tree extension implementation to support hierarchical tree-like data in Django models, using the native Postgres extension ltree.

Postgresql has already a optimized and very useful tree implementation for data. The extension is ltree

This fork contains a backport to Django 1.11 and Python 2.7.

Build Status


Coverage Status



pip install django-ltree

Then add django_ltree to INSTALLED_APPS in your Django project settings.

And make sure to run django_ltree migrations before you added the PathField

python migrate django_ltree

django_ltree migrations will install the ltree extension if not exist.

You can alternatively specify the django_ltree dependency in the migrations of your applications that requires PathField, and run migrations smoothly.

class Migration(migrations.Migration):
    dependencies = [
            ('django_ltree', '__latest__'),


  • Django 1.11 or superior
  • Python 2


Make sure you have Postgres installed. Then simply run tox in the root directory of the project.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-ltree, version 0.5.2
Filename, size File type Python version Upload date Hashes
Filename, size django_ltree-0.5.2-py2.py3-none-any.whl (8.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django_ltree-0.5.2.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page