Skip to content

Commit 8fd37ec

Browse files
authored
Merge pull request #414 from peopledoc/django-model-graph-generation
Added a tox job target to create a Django Model Graph using `dot`.
2 parents d002f61 + 5b65e73 commit 8fd37ec

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ChangeLog
55
master (unreleased)
66
==================
77

8-
Nothing to see here.
8+
- Added a tox job target to create a Django model graph using `dot`. Run `tox -e django_graph` to see the result. Since the database schema doesn't change that often, this tox target won't be associated with automated tests or doc generation - it's probably going to be a one-shot.
99

1010
Release 7.0.0 (2021-03-11)
1111
==========================

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ You can also browse the documentation locally, using the following, for example:
4646
4747
$ make docs serve-docs
4848
49+
About the model graph
50+
---------------------
51+
52+
On the "intro" page of the documentation, you can see a graph of the different Django models defined in the application.
53+
54+
To generate this graph, you'll need to have `graphviz installed <https://graphviz.org/download/>`_ on your system.
55+
56+
When you're ready, you may initiate this generation using:
57+
58+
.. code:: sh
59+
60+
$ tox -e django_graph
61+
4962
Quick-Start
5063
===========
5164

44 KB
Loading

docs/source/intro.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ Introduction
55
:mod:`django-formidable` allows your users to create/edit custom Django forms.
66
:mod:`django-formidable` provides a RESTful API, which can be used in conjunction with a front-end application.
77
A number of endpoints are provided in order to enable building forms via the API.
8+
9+
10+
Django model schema
11+
===================
12+
13+
.. image:: _static/django_graph.png

tox.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,18 @@ whitelist_externals = make
9090
changedir = docs
9191
commands =
9292
make collectstatic
93+
94+
95+
[testenv:django_graph]
96+
basepython = python3
97+
deps =
98+
; doc building is using the latest LTS version to date (june 2020)
99+
Django>=2.2,<2.3
100+
-rdemo/requirements-demo.pip
101+
django-extensions
102+
pyparsing
103+
pydot
104+
changedir = demo
105+
whitelist_externals = make
106+
commands =
107+
python manage.py graph_models formidable -o ../docs/source/_static/django_graph.png

0 commit comments

Comments
 (0)