Martin Kaffanke escribió:
> Am Mittwoch, den 11.07.2007, 13:34 -0400 schrieb Simon Drabble:
>> On Wed, 11 Jul 2007, Martin Kaffanke wrote:
>>
>>> Am Mittwoch, den 11.07.2007, 12:26 -0400 schrieb Simon Drabble:
>>>> On Wed, 11 Jul 2007, Martin Kaffanke wrote:
>>>>
>>>>> Hi there!
>>>>>
>>>>> How can I configure django to put the session (request.session) in all
>>>>> templates?
>>>>>
>>>>> I want to put a 'Hello Username' for logged in Users, and I want to do a
>>>>> dynamic login/logout button into the menu, depends on if there is a
>>>>> logged in user or not.
>>>>>
>>>>> Thanks,
>>>>> Martin
>>>>>
>>>> Extend your templates from a common base, with the session info in the 
>>>> base.
>>> Hum, I do not really understand what you mean... any links?
>>>
>>> Thanks,
>>> Martin
>>>
>> Start here:
>>
>> http://www.djangoproject.com/documentation/templates/
>>
>> Particularly:
>>
>> http://www.djangoproject.com/documentation/templates/#extends
> 
> Ok, I knew this already, but I think my problem is a bit different.
> 
> At the moment I use on some places a 
> 
> {'session': request.session} for the Context to render the template.
> How Can I make the session automaticaly available in the base template,
> without having to be aware that I don't forgett this parameter for the
> Context?
> 
> Thanks,
> Martin

I know it's not my problem, but you might consider that there might be a 
'why' for the session data not being in the template by default. 
Anyways, have a look at the auth middleware. It puts the user var into 
the templates, and that's just what you need.

However, I'd prefer to inject the needed vars manually in the view. You 
know... Business logic and all that stuff. ;)

Kind regards,
Chris Hoeppner
www.pixware.or

BTW: Extending a template does not "extend" the values of the vars, as 
they're assigned by the view on each request, AFAIK.

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to