Monthly Archives: November 2009

thread locals and user object in django

There is an interesting scenario regarding automation of routines related to model.

I want make my model in such a way that, everytime it is modified by some user, it should automatically set “modified by” field with current logged in user.
first step is to override “save” method in model, do update fields as you require and call super class save method.
but the question is, how model can access logged in user object, there is no request object wright?
there is a way with thread locals to deal with this kind of situation, click on following link
thread local and user objct in django models

Advertisements

mysql for python 2.6

if you want to use mysql with python, apart from standard installations, you also need a small integrator called mysql for python. Its a python based module to make sure that all communications with mysql from python code to look and behave similar rest of python style apis.

if you are on windows with python 2.5, you can get it from following link
mysql for python

However, for python 2.6, above installation is not working. follow below link
mysql for python 2.6