https://github.com/baseplate-admin/django-ltree-2
Postgres LTree support for django
https://github.com/baseplate-admin/django-ltree-2
django django-extensions django-orm ltree ltree-extension postgres postgresql postgresql-database postgressql python python3 tree
Last synced: 6 months ago
JSON representation
Postgres LTree support for django
- Host: GitHub
- URL: https://github.com/baseplate-admin/django-ltree-2
- Owner: baseplate-admin
- License: mit
- Created: 2024-02-22T14:40:02.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-04T22:07:20.000Z (10 months ago)
- Last Synced: 2024-12-07T09:09:13.593Z (10 months ago)
- Topics: django, django-extensions, django-orm, ltree, ltree-extension, postgres, postgresql, postgresql-database, postgressql, python, python3, tree
- Language: Python
- Homepage: https://django-ltree-2.readthedocs.io/en/latest/
- Size: 268 KB
- Stars: 38
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-ltree-2
[](https://pepy.tech/project/django-ltree-2) [](https://django-ltree-2.readthedocs.io/en/latest/?badge=latest) [](https://github.com/baseplate-admin/django-ltree-2/actions/workflows/test.yml) [](https://pypi.org/project/django-ltree-2/) [](https://results.pre-commit.ci/latest/github/baseplate-admin/django-ltree-2/master)
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 is a continuation of the work done by [`mariocesar`](https://github.com/mariocesar/) on [`django-ltree`](https://github.com/mariocesar/django-ltree) and merges the work done by [`simkimsia`](https://github.com/simkimsia) on [`greendeploy-django-ltree`](https://github.com/GreenDeploy-io/greendeploy-django-ltree)
## Install
Please remember to uninstall `django-ltree` before installing `django-ltree-2`, since both uses `django_ltree` namespace.
---
```
pip install django-ltree-2
```Then add `django_ltree` to `INSTALLED_APPS` in your Django project settings.
```python
INSTALLED_APPS = [
...,
'django_ltree',
...
]
```Then use it like this:
```python
from django_ltree.models import TreeModel
class CustomTree(TreeModel):
...```
## Requires
- Django 3.2 or superior
- Python 3.9 or higher