Jan 24 2011

Diggin’ for gold

I’m in the mid­dle of my User Inter­face design class, but I can’t pay atten­tion. A guy near me is pick­ing his nose with no regard for the oth­ers around him. Its quite amus­ing, he either does not real­ize the 50 other peo­ple, or he really just doesn’t care. Either way, I’m in awe. Ran­dom class­room musing.

Posted via email from jansepar’s pos­ter­ous


Jan 13 2011

Auto generate uml diagrams with Django

So, I recently cre­ated this GREAT UML/Class dia­gram hybrid for a Django project of mine at Elec­tronic Arts. Unfor­tu­nately, I lost the Omn­i­graf­fle source file for it… So, I went on a mis­sion to find out if there are any auto gen­er­at­ing UML tools avail­able for Django, and I was in luck.

django-command-extensions

I found a com­mand that was avail­able in this “django-command-extensions” appli­ca­tion that exports dot files, pngs, etc of your mod­els into a UML doc­u­ment. Great! But it also came with a lot of other stuff, some use­ful, some not. Check it out here:

http://code.google.com/p/django-command-extensions/

Instal­la­tion

It is wor­thy to note that I installed this on Cen­tOS! I did a wget on the fol­low­ing source file (the link below may be out of date, check out the link above to see if there is a newer ver­sion avail­able for download)

wget http://django-command-extensions.googlecode.com/files/django-extensions-0.4.1.tar.gz

tar –xzvf django-extensions-0.4.1.tar.gz

python setup.py install

Now this pack­age is installed. The next step is to install this appli­ca­tion in the “INSTALLED_APPS” sec­tion of your projects settings.py file.

INSTALLED_APPS = (

django_extensions’,

)

After you do that, do a ./manage.py help, and you should be able to see a list of all the newly avail­able com­mands. The one you are look­ing for in par­tic­u­lar is graph_models. More infor­ma­tion on the model graph­ing can be found here:

http://code.google.com/p/django-command-extensions/wiki/GraphModels

Now, before you can actu­ally use the com­mand, you’ll have to install graphviz and pygraphviz.

Ubuntu:

sudo apt-get install graphviz-dev

sudo apt-get install python-pygraphviz

Red Hat:

sudo yum install graphviz-devel

wget http://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0.tar.gz

tar –xzvf pygraphviz-1.0.tar.gz

cd pygraphviz-1.0

python setup.py install

cd pygraphviz-1.0

Once you do that, go ahead and gen­er­ate your graph!

dot file:

./manage.py graph_models –a > my_project.dot

png:

./manage.py graph_models –a –g –o my_project_visualized.png

Happy UML-ing!