Skip to content

An ltree extension implementation to support hierarchical tree-like data using the native Postgres extension ltree in django models

License

Notifications You must be signed in to change notification settings

mariocesar/django-ltree

Repository files navigation

django-ltree

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 3.6.

Test

Links

Install

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 manage.py 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__'),
    ]

Requires

  • Django 1.11 or superior
  • Python 2

Testing

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

About

An ltree extension implementation to support hierarchical tree-like data using the native Postgres extension ltree in django models

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published