Version 30 (modified by anonymous, 16 years ago) ( diff )

--

Converting Django models into Graphviz DOT files

Inspired by this nice hack by Matt Biddulph, this is a Python script that generates a Graphviz DOT file for quick visualizations of Django model definitions.

Source code

View online or download from Subversion repository (you could also set it as a svn:external on your repository to keep up to date with the latest revisons.)

Checkout

svn co svn://unicoders.org/unicoders/django/trunk/utils/ modelviz

Examples

MC Minerali Ceramici

mincer example

Command

Once you use this python script to generate the dot file (app.dot), ensure you have dot installed (part of Graphviz), and issue:

dot app.dot -Tpng -o app.png

Other References

You might also be interested in this Django app by Andrew Barilla from which I borrowed some ideas, that displays the graphviz results directly from the web.

Django-command-extensions already provides a command to visualize your models. Using an improved version of the modelviz script. It also includes/supports grouping of your Django applications. Which will group all models of a single app together. This makes larger projects much more easy and clear to view.

Usage:

 # download django-command-extensions and include it in your app.
 $ ./manage.py graph_models -a -g -o my_project.png

Feedback

Please direct all feedback to Antonio Cavedoni.

Attachments (12)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.
Back to Top