views:

108

answers:

1

I want to store the name of the user who is currently logged into Django in a custom form. In the admin we can do so by writing modified_by=request.user.username, but how do I do this in my own form?

+2  A: 

You can either define the __init__ method of your Form to accept a "request" parameter, and then pass that in from your view, or you can use the thread-locals hack.

Carl Meyer
can u define it little more
ha22109
hello please provide a satisfactory answer
ha22109
this is an *satisfactory answer*
vikingosegundo
@ha22109 If you want more details, you could explain what you've tried, what isn't working, where you're having trouble, etc. If you put in a minimum of effort, I'm glad to help out.
Carl Meyer