https://github.com/mariocesar/django-ltree
An ltree extension implementation to support hierarchical tree-like data using the native Postgres extension ltree in django models
https://github.com/mariocesar/django-ltree
django ltree postgresql-extension
Last synced: 3 months ago
JSON representation
An ltree extension implementation to support hierarchical tree-like data using the native Postgres extension ltree in django models
- Host: GitHub
- URL: https://github.com/mariocesar/django-ltree
- Owner: mariocesar
- License: mit
- Created: 2018-10-06T14:12:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-02-24T14:53:59.000Z (5 months ago)
- Last Synced: 2025-03-28T06:02:50.107Z (4 months ago)
- Topics: django, ltree, postgresql-extension
- Language: Python
- Homepage: https://pypi.org/project/django-ltree/
- Size: 97.7 KB
- Stars: 60
- Watchers: 1
- Forks: 17
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.postgresql.org/docs/9.6/static/ltree.html)This fork contains a backport to Django 1.11 and Python 3.6.
[](https://github.com/mariocesar/django-ltree/actions/workflows/test.yml)
## Links
- Pypi https://pypi.org/project/django-ltree/
- Source code https://github.com/mariocesar/django-ltree
- Bugs https://github.com/mariocesar/django-ltree/issues
- Contribute https://github.com/mariocesar/django-ltree/pulls
- Documentation `TODO`## 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.