# django-tree-perm
[![PyPI - Version](https://img.shields.io/pypi/v/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)
[![GitHub Actions Workflow Status](https://github.com/SkylerHu/django-tree-perm/actions/workflows/pre-commit.yml/badge.svg?branch=master)](https://github.com/SkylerHu/django-tree-perm)
[![GitHub Actions Workflow Status](https://github.com/SkylerHu/django-tree-perm/actions/workflows/test-py3.yml/badge.svg?branch=master)](https://github.com/SkylerHu/django-tree-perm)
[![Coveralls](https://img.shields.io/coverallsCoverage/github/SkylerHu/django-tree-perm?branch=master)](https://github.com/SkylerHu/django-tree-perm)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)
[![GitHub License](https://img.shields.io/github/license/SkylerHu/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)
[![Read the Docs](https://img.shields.io/readthedocs/django-tree-perm)](https://django-tree-perm.readthedocs.io)
django-tree-perm is implemented by Django and provides interfaces and pages for managing tree data structure nodes.
django-tree-perm 是 Django 实现的,提供了树形数据结构结点管理的接口和页面。
主要应用场景有:
- CMDB 服务树的管理;
- web 项目页面权限的管理控制;
具体使用说明可以查看 [readthedocs](https://django-tree-perm.readthedocs.io) 或者直接查看源码注释。
## 1. 安装
pip install django-tree-perm
可查看版本变更记录 [ChangeLog](https://github.com/SkylerHu/django-tree-perm/blob/master/docs/CHANGELOG-1.x.md)
## 2. 使用
在项目 `settings.py` 中配置引入:
```python
INSTALLED_APPS = [
# ...
"django_tree_perm",
]
```
在项目 `urls.py` 中加入接口配置:
```python
path("tree/", include("django_tree_perm.urls")),
```
执行数据库变更:
```shell
python manage.py migrate django_tree_perm
```
运行服务: `python manage.py runserver 0.0.0.0:8000`
可通过浏览器访问展示及管理页面 `http://localhost:8000/tree/`
## 3. 配置项
Django `settings` 额外扩展的配置项有:
| 配置项 | 类型 | 说明 | 默认值 |
| -------------------- | ---- | ---------------------------------- | ------------------------- |
| TREE_DATETIME_FORMAT | str | 用于接口返回的 JSON 数据格式化时间 | `%Y-%m-%d %H:%M:%S UTC%z` |
## 4. Demo 示例
![](https://github.com/SkylerHu/django-tree-perm/blob/master/docs/statics/demo.gif)
Raw data
{
"_id": null,
"home_page": "https://github.com/SkylerHu/django-tree-perm.git",
"name": "django-tree-perm",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "cmdb, tree, tree-permission",
"author": "SkylerHu",
"author_email": "skylerhu@qq.com",
"download_url": "https://files.pythonhosted.org/packages/f5/6c/40aa7d8b496d6f712b9501be39a179da53a00535adc19ebf4dbcc2402359/django_tree_perm-1.0.2.tar.gz",
"platform": "any",
"description": "# django-tree-perm\n\n[![PyPI - Version](https://img.shields.io/pypi/v/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)\n[![GitHub Actions Workflow Status](https://github.com/SkylerHu/django-tree-perm/actions/workflows/pre-commit.yml/badge.svg?branch=master)](https://github.com/SkylerHu/django-tree-perm)\n[![GitHub Actions Workflow Status](https://github.com/SkylerHu/django-tree-perm/actions/workflows/test-py3.yml/badge.svg?branch=master)](https://github.com/SkylerHu/django-tree-perm)\n[![Coveralls](https://img.shields.io/coverallsCoverage/github/SkylerHu/django-tree-perm?branch=master)](https://github.com/SkylerHu/django-tree-perm)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)\n[![GitHub License](https://img.shields.io/github/license/SkylerHu/django-tree-perm)](https://github.com/SkylerHu/django-tree-perm)\n[![Read the Docs](https://img.shields.io/readthedocs/django-tree-perm)](https://django-tree-perm.readthedocs.io)\n\ndjango-tree-perm is implemented by Django and provides interfaces and pages for managing tree data structure nodes.\n\ndjango-tree-perm \u662f Django \u5b9e\u73b0\u7684\uff0c\u63d0\u4f9b\u4e86\u6811\u5f62\u6570\u636e\u7ed3\u6784\u7ed3\u70b9\u7ba1\u7406\u7684\u63a5\u53e3\u548c\u9875\u9762\u3002\n\n\u4e3b\u8981\u5e94\u7528\u573a\u666f\u6709\uff1a\n\n- CMDB \u670d\u52a1\u6811\u7684\u7ba1\u7406\uff1b\n- web \u9879\u76ee\u9875\u9762\u6743\u9650\u7684\u7ba1\u7406\u63a7\u5236\uff1b\n\n\u5177\u4f53\u4f7f\u7528\u8bf4\u660e\u53ef\u4ee5\u67e5\u770b [readthedocs](https://django-tree-perm.readthedocs.io) \u6216\u8005\u76f4\u63a5\u67e5\u770b\u6e90\u7801\u6ce8\u91ca\u3002\n\n## 1. \u5b89\u88c5\n\n pip install django-tree-perm\n\n\u53ef\u67e5\u770b\u7248\u672c\u53d8\u66f4\u8bb0\u5f55 [ChangeLog](https://github.com/SkylerHu/django-tree-perm/blob/master/docs/CHANGELOG-1.x.md)\n\n## 2. \u4f7f\u7528\n\n\u5728\u9879\u76ee `settings.py` \u4e2d\u914d\u7f6e\u5f15\u5165\uff1a\n\n```python\nINSTALLED_APPS = [\n # ...\n \"django_tree_perm\",\n]\n```\n\n\u5728\u9879\u76ee `urls.py` \u4e2d\u52a0\u5165\u63a5\u53e3\u914d\u7f6e\uff1a\n\n```python\npath(\"tree/\", include(\"django_tree_perm.urls\")),\n```\n\n\u6267\u884c\u6570\u636e\u5e93\u53d8\u66f4\uff1a\n\n```shell\npython manage.py migrate django_tree_perm\n```\n\n\u8fd0\u884c\u670d\u52a1\uff1a `python manage.py runserver 0.0.0.0:8000`\n\n\u53ef\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u5c55\u793a\u53ca\u7ba1\u7406\u9875\u9762 `http://localhost:8000/tree/`\n\n## 3. \u914d\u7f6e\u9879\n\nDjango `settings` \u989d\u5916\u6269\u5c55\u7684\u914d\u7f6e\u9879\u6709\uff1a\n\n| \u914d\u7f6e\u9879 | \u7c7b\u578b | \u8bf4\u660e | \u9ed8\u8ba4\u503c |\n| -------------------- | ---- | ---------------------------------- | ------------------------- |\n| TREE_DATETIME_FORMAT | str | \u7528\u4e8e\u63a5\u53e3\u8fd4\u56de\u7684 JSON \u6570\u636e\u683c\u5f0f\u5316\u65f6\u95f4 | `%Y-%m-%d %H:%M:%S UTC%z` |\n\n## 4. Demo \u793a\u4f8b\n\n![](https://github.com/SkylerHu/django-tree-perm/blob/master/docs/statics/demo.gif)\n",
"bugtrack_url": null,
"license": "MIT Licence",
"summary": "django tree permisson",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/SkylerHu/django-tree-perm.git"
},
"split_keywords": [
"cmdb",
" tree",
" tree-permission"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe8c845e3fedbffd69dacb44dd4adc79b6046168353a1415f87a5d25ec55a246",
"md5": "dff16708e4172aefa45b3a23d2a4538d",
"sha256": "63b5dd92acd87778ebf85372173e5f5a7621bcec2632c33c139a70906770cfda"
},
"downloads": -1,
"filename": "django_tree_perm-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dff16708e4172aefa45b3a23d2a4538d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 354153,
"upload_time": "2024-11-15T16:02:44",
"upload_time_iso_8601": "2024-11-15T16:02:44.531454Z",
"url": "https://files.pythonhosted.org/packages/fe/8c/845e3fedbffd69dacb44dd4adc79b6046168353a1415f87a5d25ec55a246/django_tree_perm-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f56c40aa7d8b496d6f712b9501be39a179da53a00535adc19ebf4dbcc2402359",
"md5": "62d77ae869a2552c9da71d302fd10698",
"sha256": "f24b1c54ba37d4d9389cb1c093de489c530df50bbdef7f5183a2e1ae62091031"
},
"downloads": -1,
"filename": "django_tree_perm-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "62d77ae869a2552c9da71d302fd10698",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 357940,
"upload_time": "2024-11-15T16:02:46",
"upload_time_iso_8601": "2024-11-15T16:02:46.751449Z",
"url": "https://files.pythonhosted.org/packages/f5/6c/40aa7d8b496d6f712b9501be39a179da53a00535adc19ebf4dbcc2402359/django_tree_perm-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-15 16:02:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SkylerHu",
"github_project": "django-tree-perm",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "django-tree-perm"
}