Ok...I'm looking into using django's builtin Authentication models. I can use that to add users. However, I still need to associate a user with their favorites once they login. So do I need to add a ManyToManyField in my User table that points to my products table?
On Nov 26, 6:51 pm, pk <[EMAIL PROTECTED]> wrote: > There are a couple of things you have to do to get the "user" object > automatically available to all templates. > > 1. Follow the authentication setup as suggested. > 2. Then read the bit about > request_context:http://www.djangoproject.com/documentation/templates_python/#subclass... > You have to make sure to pass the additional > context_instance=RequestContext(request) when calling > render_to_response. > > I also write a little context processor that inserts extra session > variables from the session table to the context so that my application > session objects are always available in my templates. > > P.K. > > On Nov 26, 4:59 pm, Greg <[EMAIL PROTECTED]> wrote: > > > 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 -~----------~----~----~----~------~----~------~--~---