Why not use django's builtin Authentication models? It handles most of this for you.
from django.contrib import auth authenticate with: user = auth.authenticate(username=username, password=password) then log the user in: auth.login(request, user) and presto, in your request object, you'll always have a request.user. You can then also always put the request in your context (or even use RequestContext). Just add it to the context dictionary.. http://www.djangoproject.com/documentation/authentication/ Greg <[EMAIL PROTECTED]> writes: > Hello, > I have a website where people can login and keep track of their > favorite products. Whenever they login I create a session variable: > 'request.session['member_id']'. If this session variable is set then > I know that a user is logged in. In order to get this to work I have > to send the session variable in the return statement of every view. > Then in my template I have an if statement that either displays > 'Login' or 'Welcome, User' depending on if > 'request.session['member_id']' is True or False. > > I've created custom tags before where I bring back data from a a > class. However, I'm not sure how I create a custom tag to send a > session variable. Because the session variable is part of a request > object, and i don't know how to have my custom tag have access to the > 'request'. > > Anybody know how I can develp this so that I don't have to send my > session variable in the return statement of every view? > > Thanks > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---