Re: Avoiding the ThreadLocals hack - anything new in NewForms-Admin?

2008-04-23 Thread SmileyChris
How about this: Set your model's user field so editable=False Sub-class ModelAdmin Override its `save_add` method, setting form.data['user'] = request.user then calling the super method --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Avoiding the ThreadLocals hack - anything new in NewForms-Admin?

2008-04-23 Thread AndyB
I was reading this page http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser and was wondering how the advice on avoiding the hack applied to my own use case. I am using the ThreadLocals hack to get the current user in a model when overriding the save() method. Therefore I can't pass i