https://github.com/synw/django-mptt-graph
Graphical representation of mptt models
https://github.com/synw/django-mptt-graph
Last synced: about 2 months ago
JSON representation
Graphical representation of mptt models
- Host: GitHub
- URL: https://github.com/synw/django-mptt-graph
- Owner: synw
- License: mit
- Created: 2016-10-11T11:02:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-15T10:11:26.000Z (over 7 years ago)
- Last Synced: 2025-03-28T07:34:10.163Z (2 months ago)
- Language: Python
- Size: 20.5 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Django mptt graph
Graphical representation of any mptt model.
## Install
```
pip install django-mptt-graph
```Add `"mptt_graph",` to installed apps, make migrations and migrate
Urls: `url('^graph/', include('mptt_graph.urls')),`
## Usage
#### Graph from a tree
Go to the admin and make a Graph model object:
In `Model path` put the path to the model: `myapp.models.MyModel`
In `Root node primary key` put the primary key of the node you wish to start from
Go to `/graph/`
#### Graph directly from an url
Example: `/graph/myapp.models.MyModel/1/`
First url parameter is the path to the model and second is the root node primary key
#### Graph from custom queries
Make a view that sends a `nodes` context variable to `/templates/mptt_graph/tree.html` or use the inline template:
``{% include "mptt_graph/tree_inline.html" %}``## Screenshot
