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
2009-06-02 21:18:52
can u define it little more
ha22109
2009-06-03 04:58:44
hello please provide a satisfactory answer
ha22109
2009-06-05 10:55:45
this is an *satisfactory answer*
vikingosegundo
2009-06-09 13:20:25
@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
2009-06-09 15:37:31