Re: Using sessions in Django

2016-09-24 Thread Andreas
Thanks for the help, although i get an error, saying "DataError: value too long for type character varying(2000)" when i am trying to save the "Session.objects.get(session_ key=request.session.session_key)". I checked my db and the "session_id" column is varchar(40) (which is the default value

Re: Using sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:28 PM, Sandeep kaur wrote: > I am using session foreign key in my table. > if not request.session.exists(request.session.session_key): > request.session.create() > profile.sess = request.session.session_key > pro

Re: Using sessions in Django

2012-08-17 Thread Amyth Arora
You're Welcome. Glad to Help. On Fri, Aug 17, 2012 at 2:28 PM, Sandeep kaur wrote: > On Fri, Aug 17, 2012 at 1:39 PM, Amyth Arora > wrote: >> I think this is because you are passing it the "Session Key" instead >> of the "Session Instance", you need to get the session instance and >> then pass

Re: Using sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:39 PM, Amyth Arora wrote: > I think this is because you are passing it the "Session Key" instead > of the "Session Instance", you need to get the session instance and > then pass it to your function, Something like this: > > profile.sess = Session.objects.get(session_key

Re: Using sessions in Django

2012-08-17 Thread Thomas Orozco
My mistake then, sorry about that! Le 17 août 2012 10:34, "Tom Evans" a écrit : > On Fri, Aug 17, 2012 at 9:12 AM, Thomas Orozco > wrote: > > Session key is the session 's primary key. Not the session itself. > > > > What you want to assign to your field is a session, not its key. So use > > req

Re: Using sessions in Django

2012-08-17 Thread Tom Evans
On Fri, Aug 17, 2012 at 9:12 AM, Thomas Orozco wrote: > Session key is the session 's primary key. Not the session itself. > > What you want to assign to your field is a session, not its key. So use > request.session. > This would not work; request.session is a django.contrib.sessions.backends,Se

Re: Using sessions in Django

2012-08-17 Thread Thomas Orozco
I'm sorry, I have some trouble understanding exactly what you need, could you please try and provide a bit more context ? :-) Le 17 août 2012 10:27, "Sandeep kaur" a écrit : > On Fri, Aug 17, 2012 at 1:42 PM, Thomas Orozco > wrote: > > Session key is the session 's primary key. Not the session i

Re: Using sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:42 PM, Thomas Orozco wrote: > Session key is the session 's primary key. Not the session itself. > > What you want to assign to your field is a session, not its key. So use > request.session. > > However. > > Please very careful when using FK' s to sessions, sessions are

Re: Using sessions in Django

2012-08-17 Thread Thomas Orozco
Session key is the session 's primary key. Not the session itself. What you want to assign to your field is a session, not its key. So use request.session. However. Please very careful when using FK' s to sessions, sessions are meant to be short lived, and could / should be deleted once they exp

Re: Using sessions in Django

2012-08-17 Thread Amyth Arora
I think this is because you are passing it the "Session Key" instead of the "Session Instance", you need to get the session instance and then pass it to your function, Something like this: profile.sess = Session.objects.get(session_key=request.session.session_key) On Fri, Aug 17, 2012 at 1:28 P