Django model history with django-reversion
I’m currently working on a django project and I needed to track all changes to a model and provide a log showing what has changed (like a wiki).
I’ve found three extensions/libs that apparently could do the job for me (fullhistory, django-history and django-reversion) so I decided to test them, but because of the lack of structure/documentation of the other two I tried just the last one.
django-reversion
(http://code.google.com/p/django-reversion/)
It has a good documentation, integration with the admin and the most important for me a low level api, as I am not using the admin app for this project.
The installation went pretty well (svn co http://django-reversion.googlecode.com/svn/tags/1.1.2/src/reversion to your PYTHONPATH, add the reversion app to your INSTALLED_APPS in settings.py and the usual python manage.py syncdb).
To track the changes of a model you must register it with the reversion framework (importing reversion and calling reversion.register(YourModel)).
Reversion provides some ways for creating revisions of your model and the docs recommend that you choose one of them to use in your project. I chose the MiddleWare method because it seemed the better option for our project, but you should look the reversion documentation and decide which one is the best for you.
After registering the model and installing the MiddleWare no more changes are needed, whenever I save a model a new revision is created on the database. Another cool feature is the follow argument when registering a model. That way you can specify a ForeingKey/ManyToMany field to follow. This means that when you save the model a new revision is created with all “followed” fields in its current state. It’s very useful. See the docs for an example.
The only thing that’s not so clear for me is: what happens if I delete a field from a model that’s registered within reversion? Can you still restore its versions?
Creating a tweet gadget for Google Wave
This week bani sent me an invite for trying Google Wave. It’s a great tool and if it remains as open as Google says it will I think it can really change the way we communicate over the internets. I mean, it’s much more flexible than e-mail and it takes collaboration to another level. But, as I said, IMO the “key for success” in this case is to stay open and to support the creation of other servers and implementations(as PyGoWave [which deserves a blog post]). [ Leia mais ]
Transparência HackDay
“Two days for hacking the Brazilian politics”
This weekend (October 3rd and 4th) will happen the first “Transparência HackDay” (”Transparency HackDay” in english), a free and open hacking event with focus on bringing together hackers, activists, managers and people with ideas to make government information/public data more accessible for everyone using and writing web tools.
I’m attending and one of my ideas is to hack CET (Companhia de Engenharia de Tráfego / Traffic Engineering Company) data and make them available. The idea is to improve a crawler I wrote (in python
) that downloads and stores data about the traffic in São Paulo every 30 minutes from the “traffic now” CET website (as they don’t store it [or at least don't provide anything]).
More information about the HackDay (in portuguese):
http://www.slideshare.net/esferamobi/transparencia-hackday-proposta
São Paulo Python User Group – May Meeting
Every month the GruPy-SP members get together to discuss, chat and/or code.
This month we will meet to watch/present some lightning talks and to talk about our participation at the Fórum Internacional de Software Livre (FISL 10).
The meeting will be hold at the SP HackLab, May 23. More details (in pt-br): GruPy-SP wiki.
See you there
Global Python Sprint Weekend in São Paulo
This weekend (May 10th and 11th) will happen the Global Python Sprint Weekend. Like the last PythonBugDay our Python User Group (GruPy-SP) will meet to work together.
This time our meeting will be held at Universidade de São Paulo IME (Instituto de Matemática e Estatística) thanks to RBP and the CCSL (Free Software Competence Centre) =)
Other Python User Groups from Brazil are also meeting to work together, check the wikipage for the PythonBugDay to know if there will be a meeting near you
(or you can work from your home sweet home).


