On Jun 10, 2006, at 12:32 PM, Luke Plant wrote: > > 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.
Thanks. This worked great. Is there a list of attributes for an HttpRequest object somewhere? Todd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---