On Sep 2, 3:30 pm, Daniel Klaffenbach <danielklaffenb...@gmail.com> wrote: > Hi, > > I am developing a Django app which relies on information from the > request object a lot, especially request.user. I need this object (or > let's say at least 'REMOTE_USER') in many models and I was wondering > if there is another way to get the request object? > > In PHP there is something like $_SERVER which is a global variable > containing for example the REMOTE_USER. I'm afraid I haven't found the > Python/Django equivalent yet, but since it is a bit stupid to always > pass the request object as a parameter to objects and functions I am > sure there is another (better) approach. > > Could someone point out what I should do in this case? > > Regards, > Dan Klaffenbach
It's not clear exactly what you want. Using RequestContext and the request context processor will ensure that the request is present in all your templates. Is that enough? You say though that you need it 'in many models' - do you mean model methods? Can you give an example, perhaps there is a better way of achieving what you want to do. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.