Thank you very much for your quick replies, I didn't know about the RequestContext! Everything works like a charm now!
Kevin On 1 jun, 18:48, Genis Pujol Hamelink <[email protected]> wrote: > Hi, > > The variable you want to use should be in every page's default context. > > #views.py > from django.template import RequestContext > > def myview(request): > > myvar = foo > variables = RequestContext(request, { 'myvar' : myvar }) > return render_to_response("template.html", variables) > > In variables you will have all the variables from the default contexts plus > the ones you include in the dictionary... the auth context is loaded by > default (if i remember correctly)... > > hope it helps, > > g > > 2009/6/1 K.Berkhout <[email protected]> > > > > > > > Hi, > > > Is there a way I can access the "user.is_authenticated" method in > > every view, without having to manually pass the User model to every > > template? Basicly I want to show a login or logout link on every page, > > depending on wether the visitor is logged in or not. I've included the > > following if statement in my base template: > > > {% if user.is_authenticated %} > > Welcome {{ user }} , showing logout link... > > {% else %} > > Showing login link... > > {% endif %} > > > However, it only works with the standard "accounts/login" view, as > > that view has acces to the user.is_authenticated method. > > > Thanks, > > > Kevin > > -- > Genís --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

