Re: How to automatically insert user_id in admin

2010-08-18 Thread Martin Tiršel
I will answer myself. The solution is ModelAdmin.save_model(...) method: class TaskAdmin(admin.ModelAdmin): exclude = ('user', ) def save_model(self, request, obj, form, change): obj.user = request.user obj.save() Martin On Wed, 18 Aug 2010 02:01:33 +0200, Martin

How to automatically insert user_id in admin

2010-08-17 Thread Martin Tiršel
Hello, I need to auto-fill currently logged in user in admin after saving a model, but can not find a solution :( In save method of a model is no access to the HttpRequest object, so I don't know how to get the User. I found a "solution" with Modelform