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

One response to “thread locals and user object in django

  1. The twinz are so cute. My girlfriend said she wants kidz but were both 14 and our said we could hav children… Click http://link.mx/hool081945

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s