[IPython-dev] Django ORM magic

Martín Gaitán gaitan at phasety.com
Wed Oct 30 09:30:33 EDT 2013


Try to do some data analysis on resultados.gob.ar (the portal with official
data of the elections in Argentina) [1]  I've done a **fast and dirty**
cell magic to define django's models dynamically.

https://gist.github.com/mgaitan/7207448

usage example can be seen here:

http://nbviewer.ipython.org/7224431#modelando-resultados.gob.ar-en-una-base-de-datos


as a short rationale:

It's clear that django is not conceived for this use case, but I love its
ORM. The problem is that it needs some setup (configure "apps", databases,
etc. ). This magic handle that, and then import every model.

of course, there are tons of things to improve, but would be great some
early feedback .

cheers.
m.


[1]  In my province (Córdoba) there was an "affair" with the last
congressman seat, due the difference is very short (<0.06%) and some people
found not computed votes in the telegrams (particularly, for the Left Union
Party). I'm hacking a bit trying to find more "suspicious" cases:
http://nbviewer.ipython.org/7224431
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131030/2f986b8e/attachment.html>


More information about the IPython-dev mailing list