Re: Remove session on browser close

2010-03-23 Thread Nuno Maltez
Do you really need to show the message for the remainder of the session? Or just when the page loads right after the user has successfully subscribed? in this case you could just delete the value after being "used": if request.session.get('signed_up', True): form.thanks = True

Re: Remove session on browser close

2010-03-22 Thread Paulo Almeida
Maybe I'm missing something obvious, but can't you pass the user to the template and use: {% if user.is_authenticated %} instead of: {% if form.thanks %} It doesn't solve the problem of logging out, but you don't have to handle the session manually. - Paulo On Mon, Mar 22, 2010 at 9:40 PM, gr

Re: Remove session on browser close

2010-03-22 Thread john2095
I think the proper paradigm is to use the AnonymousUser. Rather than trying to destroy the session - something that cannot be reliably achieved - instead set the user of the session back to AnonymousUser and test/react to that. On Mar 23, 8:40 am, grimmus wrote: > Basically all i want to do is

Re: Remove session on browser close

2010-03-22 Thread grimmus
Basically all i want to do is the following : Have a newsletter signup form. When the user signs up successfully the area where the form was has a thanks message instead of the form. The form or thanks message is displayed on every page of the site, so I thought using a session would be the best

Re: Remove session on browser close

2010-03-22 Thread Bill Freeman
And if the user disables javascript, or kills the browser without normal exit, or loses his connection, or pulls the ethernet cable, or has a power failure? On Mon, Mar 22, 2010 at 10:06 AM, Wiiboy wrote: > Couldn't you use Javascript for this? For example, on the > onbeforeunload event, delete t

Re: Remove session on browser close

2010-03-22 Thread Wiiboy
Couldn't you use Javascript for this? For example, on the onbeforeunload event, delete the sessionid cookie? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from

Re: Remove session on browser close

2010-03-22 Thread Tom Evans
On Mon, Mar 22, 2010 at 11:17 AM, grimmus wrote: > Hi, > > I have a simple newsletter signup form. If the user submits the form > and there are no errors then i set the session: > > request.session['signed_up'] = True > > Then, for all other page requests i check if the session exists > >        

Remove session on browser close

2010-03-22 Thread grimmus
Hi, I have a simple newsletter signup form. If the user submits the form and there are no errors then i set the session: request.session['signed_up'] = True Then, for all other page requests i check if the session exists if request.session.get('signed_up', True): for