Hi Josh, unfortunately it seems that there is no way to do so. As you've noticed that correctly you can use request (request.user) in any place but model save.
most likely that will be view: --- if form.is_valid(): newObj = form.save(commit=False) newObj.user = request.user newObj.save() --- Cheers, Phil On Jul 17, 7:19 am, Joshua Russo <josh.r.ru...@gmail.com> wrote: > I think I might be overlooking something simple here. I have a set of > 4 fields in almost every table (user create & modified and date create > & modified). The date (datetime) is easy with auto_now and > auto_now_add options. > > The user has been much trickier. I can't figure out how (if possible) > to get access to the current user information in the context of a > model. The work around that I've implemented is a method that takes > the model, user id, and a boolean indicating modification or new. I > then use this in location where I still have a request object (and > thus request.user.id) like my views or save_model() of the admin form. > > Is this as good as I can do, or can I access the current user (or > request object) from within the model? > > Thanks > Josh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---