Re: Get the current username on models.py

2008-02-07 Thread James Bennett
On Feb 7, 2008 12:15 PM, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > If he's trying to get the logged in user instance in, say, his models > save() *and* he needs this to work from the Admin interface, he > doesn't have request.user available. That's what newforms-admin is for. -- "Bureaucrat C

Re: Get the current username on models.py

2008-02-07 Thread Rajesh Dhawan
Hi James, On Feb 7, 1:09 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Feb 7, 2008 11:44 AM, Henhiskan <[EMAIL PROTECTED]> wrote: > > > > See:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > > Thanks a lot, is exactly that I was looking for > > This is a really bad idea; i

Re: Get the current username on models.py

2008-02-07 Thread James Bennett
On Feb 7, 2008 11:44 AM, Henhiskan <[EMAIL PROTECTED]> wrote: > > See:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > Thanks a lot, is exactly that I was looking for This is a really bad idea; in almost 100% of cases, it's better to be writing something in your view which reads

Re: Get the current username on models.py

2008-02-07 Thread Henhiskan
On 7 feb, 12:22, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > See:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser Thanks a lot, is exactly that I was looking for --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: Get the current username on models.py

2008-02-07 Thread Rajesh Dhawan
> > The idea is save on the ModelChangelog the name of the user that did a > change on Region class. > I try with User() but this is an object without intance. The object > that I need is exactly like a request.user that is used in view.py > when some user make a request. > Any idea how can do tha

Get the current username on models.py

2008-02-07 Thread Henhiskan
Hi fellows, I have running django 0.96 and I try to get the name of the current user (logged in admin interface) to use in the models.py. The model is like: class Region(models.Model): name = models.CharField(maxlength=60) def save(self): changelog = ModelChangelog(username=User().use