On Saturday 10 June 2006 16:40, Todd O'Bryan wrote:

> so I'd like to add userinfo to the context by default. To do that,
> I've figured out that I need to add my own function to
> TEMPLATE_CONTEXT_PROCESSORS, but I'm a little confused how to get the
> currently logged in user so I can get the appropriate user info.
>
> def userInfoProcessor(request):
>       #this will get called after django.core.context_processors.auth, so
>       #the user will be in the context, but how do I get access to the
> context
>       #if I only have an HttpRequest instance?
>       ui = #somehow get the appropriate UserInfo instance
>       return { 'userinfo':ui }
>
> What am I missing?

You can get the User object direct from the request object  -- 
request.user (assuming it is the currently logged in user you want), 
and get the UserInfo from that.

Luke

-- 
The probability of someone watching you is proportional to the 
stupidity of your action.

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to