Re: session variable in template
On Wed, 2007-06-13 at 07:31 +, Dushyant Sharma wrote: > how can i use it with HttpResponseRedirect() > > like if i wish to use it as return HttpResponseRedirect('/someurl', > RequestContext(request)) You don't pass a context to HttpResponseRedirect because it doesn't render a template. However, if you look at the link I posted earlier, you'll see that setting up the authentication middleware provides the request object and access to logged in users in every single template by default. At least every template that is passed a RequestContext, but that is under your control in your views and is done by default for generic views. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: session variable in template
how can i use it with HttpResponseRedirect() like if i wish to use it as return HttpResponseRedirect('/someurl', RequestContext(request)) is it possible On Jun 13, 5:42 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-06-12 at 13:27 +, Dushyant Sharma wrote: > > i am building single page for logged in users and anonymous users > > where i can use uid for logged in users and show specific things to > > them and for this i want to use session variable in template. i am > > trying request.session.uid in template where uid is session > > variable.. > > Have a read > ofhttp://www.djangoproject.com/documentation/authentication/#authentica > That should explain what you need. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: session variable in template
On Tue, 2007-06-12 at 13:27 +, Dushyant Sharma wrote: > i am building single page for logged in users and anonymous users > where i can use uid for logged in users and show specific things to > them and for this i want to use session variable in template. i am > trying request.session.uid in template where uid is session > variable.. Have a read of http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates . That should explain what you need. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: session variable
WowI just needed to read a little bit further. Thanks. Seth --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: session variable
On 2/23/07, Seth Buntin <[EMAIL PROTECTED]> wrote: > > So I can have for instance: > > request.session["order_items"] = [] > > and then in different view I can have: > > request.session["order_items"].append(1) > > and that append to the session variable? yes, but the session itself doesn't know that you modified it, so you will have to save it yourself, see http://www.djangoproject.com/documentation/sessions/#when-sessions-are-saved > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: session variable
So I can have for instance: request.session["order_items"] = [] and then in different view I can have: request.session["order_items"].append(1) and that append to the session variable? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---